在任务管理器的“应用程序”选项卡中设置应用程序名称
我有一个用 C# 编写的 .NET 3.5 WinForms 应用程序,需要在任务管理器的“应用程序”选项卡中显示特定名称。但是,我需要此文本与表单的文本不同。
到目前为止我看到的行为是任务管理器应用程序选项卡将显示正在显示的 System.Windows.Forms.Form 的 Text 属性的值。但是,我想在 Form.Text 属性中显示应用程序的长名称,并在任务管理器的“应用程序”选项卡中使用缩写名称。
我知道 VB6 支持这种行为,其中应用程序标题(通过项目属性 -> Make 选项卡 -> 应用程序标题字段设置,或在 .VBP 文件本身中)将是“应用程序”选项卡中显示的名称。有没有办法在 C#/.NET 中复制此功能?
来自 MSDN 的这一信息似乎表明 Text 属性是 .NET 中的唯一来源: 适用于 Visual Basic 6.0 用户的应用程序对象。不过,我想知道是否有办法解决这个问题。
I have a WinForms application written in C# for .NET 3.5 that needs to show a specific name in the Task Manager's Applications tab. However, I need for this text to be different from the Form's text.
The behavior I've seen so far is that the Task Manager Applications tab will show the value of the Text property of the System.Windows.Forms.Form being displayed. However, I'd like to display the long name of the application in the Form.Text property, and use an abbreviated name in the Task Manager's Applications tab.
I know this behavior was supported in VB6, where the Application Title (Set through Project Properties -> Make tab -> Application Title field, or in the .VBP file itself) would be the name displayed in the Applications tab. Is there a way to replicate this functionality in C#/.NET?
This bit of information from MSDN seems to indicate that the Text property is the only source in .NET: App Object for Visual Basic 6.0 Users. However, I'd like to know if there's a way around this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VB6.0 窗体应用程序使用隐藏的“停车窗口”作为应用程序的真正主窗口。这就是它允许任务管理器名称与主窗口名称不同的方式。在 .Net 应用程序中,主窗口是应用程序的真正主窗口。
您可以通过启动一个调用可显示表单的隐藏表单来复制该行为,但我不建议这样做,因为您可能会冒着使应用程序进入没有可见 UI 但进程仍在运行的状态的风险。
VB6.0 forms applications used a hidden "parking window" as the true main window of the application. This is how it allowed the task manager name to differ from the main window name. In .Net applications the main window is the true main window of the application.
You could replicate the behavior by starting a hidden form which calls your displayable form but I don't recommend it since you risk getting your application into a state where there is no visible UI but the process is still running.