简体   繁体   English

我在Windows窗体应用程序中使用了MDI,它未在任务栏中显示应用程序图标

[英]I have used MDI in my Windows Form Application, it is not showing the application icon in taskbar

I have a login form and then a master form which uses MDI. 我有一个登录表单,然后有一个使用MDI的主表单。 The master form inherits MetroForm. 主窗体继承MetroForm。 I have already set the icon in Window Style > Icon, ShowIcon as True, ShowInTaskbar as True for the master form. 我已经在“窗口样式>图标”中将图标设置为True,将ShowIcon设置为True,将主窗体的ShowInTaskbar设置为True。 I have set the icon in MyApp > Properties > Application > Icon and manifest. 我已经在MyApp>属性>应用程序>图标和清单中设置了图标。 Still it is not showing the icon in taskbar for the master form . 仍然没有在主窗体的任务栏中显示图标 Only the login form is showing the icon. 仅登录表单显示图标。

As you start your APP into the login form, then this is considered the "main" form so the APP icon shows for this form. 当您将APP启动到登录表单时,这被视为“主”表单,因此该表单的APP图标将显示。 Because you then open another form (your master form) then this will not use the APP icon but its own icon. 因为您随后打开了另一个表单(您的主表单),所以它将不使用APP图标,而是使用其自己的图标。 This is because each form also has its own icon. 这是因为每个表单也都有自己的图标。

So you need to set the icon for the form individually. 因此,您需要单独设置表单的图标。

To do this in the form designer select your form, go to the properties and under the section ""WindowStyle" you will find an "Icon". Open this and select the icon you want to use. 为此,请在表单设计器中选择表单,然后转到属性,然后在“ WindowStyle”部分下找到一个“图标”,打开它并选择要使用的图标。

在此处输入图片说明

Case 1: You need to give your form that icon as well. 情况1:您还需要在表单中添加该图标。 The application icon is the one that is embedded in the application and displayed in Explorer or on shortcuts. 应用程序图标是嵌入在应用程序中并显示在资源管理器或快捷方式中的图标。 Each form can have its own icon, though. 不过,每种形式都可以有自己的图标。

Case 2: Set the Form.Icon Property through code also consider the below suggestion from MSDN 情况2:通过代码设置Form.Icon属性还考虑MSDN的以下建议

A form's icon designates the picture that represents the form in the taskbar as well as the icon that is displayed for the control box of the form. 表单的图标指定在任务栏中代表该表单的图片以及为该表单的控制框显示的图标。 This property will have no effect if FormBorderStyle is set to FixedDialog . 如果将FormBorderStyle设置为FixedDialog则此属性无效。 In that case, the form will not display an icon. 在这种情况下,表单将不会显示图标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM