开发者

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

开发者 https://www.devze.com 2023-01-09 02:25 出处:网络
I have written a script which is basically a small wys开发者_C百科iwyg signature generator for Outlook. We want our signatures to be in corporate colours, and semi-standardised - hence the requirement

I have written a script which is basically a small wys开发者_C百科iwyg 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?


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

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

精彩评论

暂无评论...
验证码 换一张
取 消