【问题标题】:Windows Forms look different in Powershell and Powershell ISE. Why?Windows 窗体在 Powershell 和 Powershell ISE 中看起来不同。为什么?
【发布时间】:2011-03-22 11:08:25
【问题描述】:

我编写了一个脚本,它基本上是一个用于 Outlook 的小型所见即所得签名生成器。我们希望我们的签名采用公司颜色,并且是半标准化的 - 因此需要这样做。

我在 Powershell ISE 中进行了开发工作,一切看起来都不错。但是,当我仅使用 powershell 运行脚本时(就像用户那样),它看起来完全不同:

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

顶部是在 ISE 中生成的,看起来与我想要的一样。最下面的是直接从powershell运行的,视觉上好像退步了五年!

如何让脚本在 Powershell 中看起来像在 Powershell ISE 中一样时髦?

谢谢,

【问题讨论】:

  • 好主意!如果你的雇主很酷,请考虑在 PoshCode.org(或其他地方)上分享脚本。

标签: forms powershell powershell-ise


【解决方案1】:

在显示表单之前在脚本中添加以下行:

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

【讨论】:

  • 我真的爱你!干杯老兄,这让我上墙了!
  • NP。顺便说一句,如果这回答了您的问题,您可能希望将其标记为已回答。 :-)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-05
  • 2012-01-10
  • 2012-12-28
  • 1970-01-01
  • 2018-12-10
  • 2015-08-28
相关资源
最近更新 更多