【问题标题】:Why does my System Windows Form look different when the .ps1 file is run from a shortcut?从快捷方式运行 .ps1 文件时,为什么我的系统 Windows 窗体看起来不同?
【发布时间】:2022-01-06 04:42:55
【问题描述】:

我正在使用 System.Windows.Forms 程序集中的 Windows.Forms.MonthCalendar。

从 Powershell ISE 运行脚本时,它看起来像这样:

但是当通过 dekstop 快捷方式运行脚本时,它看起来像这样: (快捷方式目标:C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Temp\Test.ps1")

如果 Powershell ISE 使用的是更高版本的 Powershell,我如何在快捷方式中使用该版本?

TIA

【问题讨论】:

标签: forms powershell winforms monthcalendar


【解决方案1】:

创建表单前需要添加以下内容:

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

【讨论】:

    猜你喜欢
    • 2011-01-07
    • 1970-01-01
    • 1970-01-01
    • 2011-03-22
    • 2021-09-09
    • 2017-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多