Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Forms look different in Powershell and Powershell ISE. Why?

I have written a script which is basically a small wysiwyg signature generator for Outlook. We want our signatures to be in corporate colours, and semi-standardised - hence the requirement for this.

I did the development work in Powershell ISE and all looked good. However, when I run the script just using powershell (as the users will) it looks totally different:

Powershell vs Powershell ISE http://www.freeimagehosting.net/uploads/1d6e6c5c6f.png

The top one was generated in ISE, and looks as I want it. The bottom one was run from powershell directly and seems to have visually regressed five years!

How can I get the script to look as snazzy in Powershell as it does in Powershell ISE?

Thanks,

Ben

like image 760
Ben Avatar asked Jul 28 '10 23:07

Ben


People also ask

What is the difference between Windows PowerShell and PowerShell ISE?

The principal difference between the two is convenience. PowerShell is a simpler and more straightforward scripting and execution environment, while the ISE provides more flexible and forgiving editing and execution features. PowerShell can be a good platform for simple tasks where actions are clear.

What is Microsoft's IntelliSense and how does it benefit a PowerShell ISE user?

IntelliSense is an automatic-completion assistance feature that is part of Windows PowerShell ISE. IntelliSense displays clickable menus of potentially matching cmdlets, parameters, parameter values, files, or folders as you type.

Is there a dark mode for PowerShell ISE?

Select a ThemeThe default theme is “Dark Console, Light Editor” which is pleasant enough for starting off, but I prefer the “Dark Console, Dark Editor” theme to give code greater contrast and also emulate the natural PowerShell CLI. To make this change, navigate to Tools > Options > Colors and Fonts > Manage Themes.


1 Answers

Add the following line in your script before you show the form:

[System.Windows.Forms.Application]::EnableVisualStyles();
like image 174
Keith Hill Avatar answered Oct 16 '22 18:10

Keith Hill