久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何向 System.Windows.Forms.MenuItem 添加圖標(biāo)?

How to add an icon to System.Windows.Forms.MenuItem?(如何向 System.Windows.Forms.MenuItem 添加圖標(biāo)?)
本文介紹了如何向 System.Windows.Forms.MenuItem 添加圖標(biāo)?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我嘗試將圖標(biāo)添加到我的上下文菜單項(xiàng)之一,但我無(wú)法做到.有人可以幫我嗎?

I tried to add an icon to one of my context menu items, but I couldn't do it. Can anybody help me?

這是我寫(xiě)的代碼:

 private System.Windows.Forms.ContextMenu notifyContextMenu;
 private void foo() {
            if (notifyIcon == null) {
                notifyIcon = new System.Windows.Forms.NotifyIcon();   
            }

           if (notifyContextMenu == null) {
               notifyContextMenu = new System.Windows.Forms.ContextMenu();
               notifyContextMenu.MenuItems.Add("Exit");
               // How do I add an icon to this context menu item?
             }
            notifyIcon.ContextMenu =  notifyContextMenu;
          }
     }

推薦答案

MainMenu/ContextMenu 已過(guò)時(shí),您應(yīng)該改用菜單條類(lèi).

MainMenu/ContextMenu are obsolete, you should use the menu strip classes instead.

改變

notifyContextMenu = new System.Windows.Forms.ContextMenu();
notifyContextMenu.MenuItems.Add("Exit");

notifyContextMenu = new System.Windows.Forms.ContextMenuStrip();
var exitMenuItem = notifyContextMenu.Items.Add("Exit");
exitMenuItem.Image = ...;

http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripitem.image.aspx

最后附上上下文菜單條以通知圖標(biāo),

Finally attach the context menu strip to notify icon,

notifyIcon.ContextMenuStrip = notifyContextMenu;

這篇關(guān)于如何向 System.Windows.Forms.MenuItem 添加圖標(biāo)?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Right-click on a Listbox in a Silverlight 4 app(右鍵單擊 Silverlight 4 應(yīng)用程序中的列表框)
WPF c# webbrowser scrolls over top menu(WPF c# webbrowser 在頂部菜單上滾動(dòng))
C# Console app - How do I make an interactive menu?(C# 控制臺(tái)應(yīng)用程序 - 如何制作交互式菜單?)
How to avoid duplicate form creation in .NET Windows Forms?(如何避免在 .NET Windows Forms 中創(chuàng)建重復(fù)的表單?)
Building a database driven menu with ASP.NET, JQuery and Suckerfish(使用 ASP.NET、JQuery 和 Suckerfish 構(gòu)建數(shù)據(jù)庫(kù)驅(qū)動(dòng)的菜單)
UI Automation Control Desktop Application and Click on Menu Strip(UI自動(dòng)化控制桌面應(yīng)用程序并單擊菜單條)
主站蜘蛛池模板: www.99色| 免费网站av | 国产网站在线 | 日日操天天操 | 麻豆中文字幕 | 日韩专区中文字幕 | 日本不卡高字幕在线2019 | 国产成人午夜高潮毛片 | 日韩在线观看av | 在线观看免费黄色 | 久久精品欧美 | 欧美日韩免费在线 | 性av在线| 国产农村妇女精品一二区 | 五月天视频 | 欧美亚洲天堂 | 国产精品成人av | 精品久久一区二区 | 男人添女荫道口图片 | 欧美专区第一页 | 久久国产一区 | 国产精品羞羞答答 | 中文字幕亚洲视频 | 激情综 | 亚洲免费看片 | 国产高潮在线观看 | 伊人久久网站 | 一区二区三区网站 | 一个色综合网 | 伊人精品久久 | 亚洲一区二区三区视频 | 久久av一区二区三区亚洲 | 色污污 | 久久国产精品免费 | 欧美精品入口蜜桃 | 午夜视频免费 | 手机成人在线视频 | 成人黄色在线观看 | 欧美在线一区二区 | 欧美激情成人 | 特黄视频|