In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
< node.ChildNodes.Count - 1;i++ ) { child1 = node.ChildNodes[i]; //检查是否提供了类型 asmname = child1.Attributes["AssemblyName"].Value; formtag = child1.Attributes["FormTag"].Value; text = child1.Attributes["Name"].Value; OfficeMenuItem childitem; childitem = new OfficeMenuItem(true, text, handler); childitem.Name = text; mc = new MenuClass(); mc.Assemblyname = asmname; mc.FormTag = formtag; childitem.Tag = mc; //添加快捷键 msc = child1.Attributes["ShortCut"].Value; if(msc != string.Empty) { childitem.Shortcut = MenuShortCut.GetShortCut(msc); } //添加图标 iconname = child1.Attributes["Image"].Value; if(iconname != string.Empty) { iconpath = Themes.GetCurrentThemePath() + iconname; childitem.IconPath = iconpath; } parent.MenuItems.Add(childitem); if((iconpath != string.Empty) && System.IO.File.Exists(iconpath)) { //添加按钮到OutlookBar PanelIcon picon = ip.AddIcon(childitem.Text, Image.FromFile(iconpath), handler1); picon.Tag = mc; //添加按钮到toolbar ToolStripButton button = new ToolStripButton(childitem.Text, Image.FromFile(iconpath), handler2); button.DisplayStyle = ToolStripItemDisplayStyle.Image; button.ToolTipText = childitem.Text; button.Tag = mc; button.Visible = true; _toolbar.Items.Add(button); } iconpath = ""; mc = null; if(child1.ChildNodes.Count >0) {GetChildMenu (ip,childitem, child1) } / * * / Open a combination of form / form class assembly and form class, and get private void OpenForm (MenuClass mc) {string asmname = mc.Assemblyname; string formtag = mc.FormTag from the AssemblyName property of the node. If (formtag = = "") {throw new Exception (Resources.StringNoFormFlag);} if (formtag.ToUpper () = = "TRUE") {if (asmname = = string.Empty) {throw new NullReferenceException (Resources.StringAssemblyNull) } / / string [] a = asmname.Split (','); object obj = null; Type tp = Type.GetType (asmname); if (tp! = null) {obj = Activator.CreateInstance (tp) } else {throw new Exception ("an error occurred while loading the program, please check whether the program (dll,exe) exists or is of the correct type.") ;} / / check whether it is Form class if ((obj = = null) |! (obj is Form)) {throw new Exception (Resources.StringNotForm);} Form frm = (obj as Form) / / check whether the first window opened is MDIFORM if (Application.OpenForms [0] .IsMdiContainer) {/ / as MDICHILDFORM frm.MdiParent = Application.OpenForms [0];} / load form frm.Show () }} / * / menu Click event / private void OnPluginClick (object sender, EventArgs args) {OfficeMenuItem item = (OfficeMenuItem) sender; MenuClass mc = (MenuClass) item.Tag If ((item.Text = = "EXIT") | (item.Text = = "EXIT") {OnExitClick (sender, args); return;} OpenForm (mc);}}
Delegate is used in this, and the most important function is to load the menu function and the OnPluginClick function.
Using this framework, you can dynamically add modules at any level.
Microsoft's CAB uses Resigster site to add modules, which is not very convenient.
This is the end of this article on "sample Analysis based on XML Module Integration Framework". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.