Share via


PowerShell Tip: Visual Styles in PowerShell Forms

Question

I have a PowerShell script which outputs a form GUI. It worked fine in ISE but not in console. The button looks weird in the console.

Screenshot

The Screenshot from ISE:

The Screenshot from Console:

Answer

Indeed yes, if we haven't enabled visual style then the look and feel changes. So we need to add the code available in Solution.

Solution

[System.Windows.Forms.Application]::EnableVisualStyles()
$ButtonClose.FlatStyle ="Standard"

Enjoy PowerShell :)