Extender.cs
上传用户:szlfmled
上传日期:2020-11-22
资源大小:978k
文件大小:2k
源码类别:

C#编程

开发平台:

C#

  1. using System;
  2. using System.Drawing;
  3. using WeifenLuo.WinFormsUI.Docking;
  4. namespace DockSample.Customization
  5. {
  6.     public class Extender
  7.     {
  8.         public enum Schema
  9.         {
  10.             VS2005,
  11.             VS2003
  12.         }
  13.         private class VS2003DockPaneStripFactory : DockPanelExtender.IDockPaneStripFactory
  14.         {
  15.             public DockPaneStripBase CreateDockPaneStrip(DockPane pane)
  16.             {
  17.                 return new VS2003DockPaneStrip(pane);
  18.             }
  19.         }
  20.         private class VS2003AutoHideStripFactory : DockPanelExtender.IAutoHideStripFactory
  21.         {
  22.             public AutoHideStripBase CreateAutoHideStrip(DockPanel panel)
  23.             {
  24.                 return new VS2003AutoHideStrip(panel);
  25.             }
  26.         }
  27.         private class VS2003DockPaneCaptionFactory : DockPanelExtender.IDockPaneCaptionFactory
  28.         {
  29.             public DockPaneCaptionBase CreateDockPaneCaption(DockPane pane)
  30.             {
  31.                 return new VS2003DockPaneCaption(pane);
  32.             }
  33.         }
  34.         public static void SetSchema(DockPanel dockPanel, Extender.Schema schema)
  35.         {
  36.             if (schema == Extender.Schema.VS2005)
  37.             {
  38.                 dockPanel.Extender.AutoHideStripFactory = null;
  39.                 dockPanel.Extender.DockPaneCaptionFactory = null;
  40.                 dockPanel.Extender.DockPaneStripFactory = null;
  41.             }
  42.             else if (schema == Extender.Schema.VS2003)
  43.             {
  44.                 dockPanel.Extender.DockPaneCaptionFactory = new VS2003DockPaneCaptionFactory();
  45.                 dockPanel.Extender.AutoHideStripFactory = new VS2003AutoHideStripFactory();
  46.                 dockPanel.Extender.DockPaneStripFactory = new VS2003DockPaneStripFactory();
  47.             }
  48.         }
  49.     }
  50. }