Powershell Tip : Force the "Modern Visual Style" for Windows forms



If you created a Powershell script using Windows Form, with PrimalForm for an example, this form may not appear as expected depending on where you launched this script.


Indeed your Form could appear with an old interface, as below :

To resolve this issue and force your form to be displayed correctly you have to add the line below to your script :

[System.Windows.Forms.Application]::EnableVisualStyles()

By this way, your Form should appear as below :








You can see more informations about the visual style HERE.

Share this

Related Posts

Previous
Next Post »