C # WinForm Tips Eight: interface development "Weifenluo.winformsui.docking+outlookbar" use

Source: Internet
Author: User

Overview

Transfer from http://www.cnblogs.com/luomingui/archive/2013/09/19/3329763.html

In recent days has been concerned about the winfrom aspects of the article is thinking about refining the public part of the project, the public sector is divided into the interface, class library two aspects, today is mainly the interface is refined first.

WeifenLuo.WinFormsUI.Docking + OutlookBar combined with the

WeifenLuo.WinFormsUI.Docking Modifying Records

From http://sourceforge.net/projects/ Dockpanelsuite Download source new Dockcontentex file and inherit WeifenLuo.WinFormsUI.Docking.DockContent add contextmenustrip menu tool and join close Close all except all three menus are closed. The project structure is as follows

Component Structure diagram:

The source code is as follows:

<summary>//////Many forms have a right-click menu in the tab, right-clicking inside has a close, so it is best to inherit the dockcontent,///Let other forms as long as the inheritance of this right-click menu///</summary&    Gt public class Dockcontentex:dockcontent {//Right-click on the tab to display the Close menu public Dockcontentex () {S Ystem.            Windows.Forms.ContextMenuStrip cms = new System.Windows.Forms.ContextMenuStrip (); Tsmiclose//System.Windows.Forms.ToolStripMenuItem tsmiclose = new System.window            S.forms.toolstripmenuitem ();            Tsmiclose.name = "CMS";            Tsmiclose.size = new System.Drawing.Size (98, 22);            Tsmiclose.text = "Off";            Tsmiclose.click + = new System.EventHandler (This.tsmiclose_click); Tsmiallclose//System.Windows.Forms.ToolStripMenuItem tsmiallclose = new System.            Windows.Forms.ToolStripMenuItem ();            Tsmiallclose.name = "CMS";            Tsmiallclose.size = new System.Drawing.Size (98, 22); TsmiallclosE.text = "Close all";            Tsmiallclose.click + = new System.EventHandler (This.tsmiallclose_click);  Tsmiapartfromclose//System.Windows.Forms.ToolStripMenuItem Tsmiapartfromclose =            New System.Windows.Forms.ToolStripMenuItem ();            Tsmiapartfromclose.name = "CMS";            Tsmiapartfromclose.size = new System.Drawing.Size (98, 22);            Tsmiapartfromclose.text = "All except the other is closed";            Tsmiapartfromclose.click + = new System.EventHandler (This.tsmiapartfromclose_click); Tsmiclose//CMS.            Items.addrange (new system.windows.forms.toolstripitem[] {tsmiclose,tsmiapartfromclose,tsmiallclose}); Cms.            Name = "Tsmiclose"; Cms.            Size = new System.Drawing.Size (99, 26); This.        Tabpagecontextmenustrip = CMS; private void Tsmiclose_click (object sender, EventArgs e) {this.        Close (); } private void TsmialLclose_click (object sender, EventArgs e) {dockcontentcollection contents = dockpanel.contents;            int num = 0; while (Num < contents. Count) {if (Contents[num]. Dockhandler.dockstate = = dockstate.document) {Contents[num].                Dockhandler.hide ();                } else {num++; }}} private void Tsmiapartfromclose_click (object sender, EventArgs e) {DOCKC            Ontentcollection contents = dockpanel.contents;            int num = 0; while (Num < contents. Count) {if (Contents[num].                    Dockhandler.dockstate = = Dockstate.document && dockpanel.activecontent! = Contents[num]) { Contents[num].                Dockhandler.hide ();                } else {num++;    }            }    }    } 

Double-clicking the close tag code mainly modifies the protected override void WndProc (ref Message m) function code in the DockPaneStripBase.cs class as follows

[SecurityPermission (SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]        protected override void WndProc (ref Message m)        {            if (m.msg = = (int) Win32.Msgs.WM_LBUTTONDBLCLK)            {                base . WndProc (ref m);                int index = HitTest ();                if (DockPane.DockPanel.AllowEndUserDocking && Index! =-1)                {                    idockcontent content = Tabs[index]. Content;                    if (content. Dockhandler.checkdockstate (!content. dockhandler.isfloat)! = Dockstate.unknown)                    //    content. Dockhandler.isfloat =!content. Dockhandler.isfloat;                    else                    //    content. Dockhandler.close ();                    Implementing double-clicking the document tab closes automatically                    
if
(content. Dockhandler.hideonclose)                        content. Dockhandler.hide ();//Hide                     else                        // close                       }                return            ;            Base. WndProc (ref m);            return;        }

That's how I stole the code.

The plugin code uses the code inside the OEA framework, and logging uses the SuperSocket code.

1: Gets all DLLs from the specified directory to memory.

2: Add the OutlookBar control to the Toolboxfrm interface and display it.

The use of the layout control "WeifenLuo.WinFormsUI.Docking" for WinForm Interface development

WinForm interface Development "OutlookBar" tool bar

Http://sourceforge.net/projects/dockpanelsuite

http://download.csdn.net/detail/luomingui/6290535

Http://home.cnblogs.com/group/topic/54686.html
http://blog.csdn.net/dqvega/article/details/7594923

C # WinForm Tip Eight: interface development "Weifenluo.winformsui.docking+outlookbar" use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.