Powershell GUI window, how to remove the borders and buttons

Hi Pros

Is there any way to hide the borders and buttons of a windows form, to use my own closing button.
I can’t find nothing in the internet about the borders and how can i hide them or how to remove them from windows forms.

This is my code:


$objForm = New-Object System.Windows.Forms.Form
$objForm.Text = "PingMaster v1.1"
$objForm.Size = New-Object System.Drawing.Size(350,250)
$objForm.StartPosition = "CenterScreen"
$objForm.KeyPreview = $True
$objForm.MaximumSize = $objForm.Size
$objForm.MinimumSize = $objForm.Size
$objForm.BackColor = "Black"

Thx. very much.

Hi, welcome to the forum :wave:

Firstly, when posting code in the forum, please can you use the preformatted text </> button. It really helps us with readability, and copying and pasting your code (we don’t have to faff about replacing curly quote marks to get things working).

How to format code on PowerShell.org

This is the Microsoft documentation for Windows Forms:

To remove the border, use:

$objForm.FormBorderStyle = 0
2 Likes

Thx for the help, next time i will formate the code, I’m sorry for that mistake.
This tip is gold thx :smiley:

1 Like