dockpanel.cs
来自「c#源代码」· CS 代码 · 共 988 行 · 第 1/3 页
CS
988 行
internal DockPanelExtender.IAutoHideTabFactory AutoHideTabFactory
{
get { return Extender.AutoHideTabFactory; }
}
internal DockPanelExtender.IAutoHidePaneFactory AutoHidePaneFactory
{
get { return Extender.AutoHidePaneFactory; }
}
internal DockPanelExtender.IAutoHideStripFactory AutoHideStripFactory
{
get { return Extender.AutoHideStripFactory; }
}
private DockPaneCollection m_panes;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="Panes"]/*' />
[Browsable(false)]
public DockPaneCollection Panes
{
get { return m_panes; }
}
internal Rectangle DockArea
{
get
{
return new Rectangle(DockPadding.Left, DockPadding.Top,
ClientRectangle.Width - DockPadding.Left - DockPadding.Right,
ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom);
}
}
private double m_dockBottomPortion = 0.25;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="DockBottomPortion"]/*' />
[LocalizedCategory("Category.Docking")]
[LocalizedDescription("DockPanel.DockBottomPortion.Description")]
[DefaultValue(0.25)]
public double DockBottomPortion
{
get { return m_dockBottomPortion; }
set
{
if (value <= 0 || value >= 1)
throw new ArgumentOutOfRangeException();
if (value == m_dockBottomPortion)
return;
m_dockBottomPortion = value;
if (m_dockTopPortion + m_dockBottomPortion > 1)
m_dockTopPortion = 1 - m_dockBottomPortion;
PerformLayout();
}
}
private double m_dockLeftPortion = 0.25;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="DockLeftPortion"]/*' />
[LocalizedCategory("Category.Docking")]
[LocalizedDescription("DockPanel.DockLeftPortion.Description")]
[DefaultValue(0.25)]
public double DockLeftPortion
{
get { return m_dockLeftPortion; }
set
{
if (value <= 0 || value >= 1)
throw new ArgumentOutOfRangeException();
if (value == m_dockLeftPortion)
return;
m_dockLeftPortion = value;
if (m_dockLeftPortion + m_dockRightPortion > 1)
m_dockRightPortion = 1 - m_dockLeftPortion;
PerformLayout();
}
}
private double m_dockRightPortion = 0.25;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="DockRightPortion"]/*' />
[LocalizedCategory("Category.Docking")]
[LocalizedDescription("DockPanel.DockRightPortion.Description")]
[DefaultValue(0.25)]
public double DockRightPortion
{
get { return m_dockRightPortion; }
set
{
if (value <= 0 || value >= 1)
throw new ArgumentOutOfRangeException();
if (value == m_dockRightPortion)
return;
m_dockRightPortion = value;
if (m_dockLeftPortion + m_dockRightPortion > 1)
m_dockLeftPortion = 1 - m_dockRightPortion;
PerformLayout();
}
}
private double m_dockTopPortion = 0.25;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="DockTopPortion"]/*' />
[LocalizedCategory("Category.Docking")]
[LocalizedDescription("DockPanel.DockTopPortion.Description")]
[DefaultValue(0.25)]
public double DockTopPortion
{
get { return m_dockTopPortion; }
set
{
if (value <= 0 || value >= 1)
throw new ArgumentOutOfRangeException();
if (value == m_dockTopPortion)
return;
m_dockTopPortion = value;
if (m_dockTopPortion + m_dockBottomPortion > 1)
m_dockBottomPortion = 1 - m_dockTopPortion;
PerformLayout();
}
}
private DockWindowCollection m_dockWindows;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="DockWindows"]/*' />
[Browsable(false)]
public DockWindowCollection DockWindows
{
get { return m_dockWindows; }
}
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="Documents"]/*' />
[Browsable(false)]
public DockContent[] Documents
{
get { return Contents.Select(DockAreas.Document); }
}
private Rectangle DocumentRectangle
{
get
{
Rectangle rect = DockArea;
if (DockWindows[DockState.DockLeft].DisplayingList.Count != 0)
{
rect.X += (int)(DockArea.Width * DockLeftPortion);
rect.Width -= (int)(DockArea.Width * DockLeftPortion);
}
if (DockWindows[DockState.DockRight].DisplayingList.Count != 0)
rect.Width -= (int)(DockArea.Width * DockRightPortion);
if (DockWindows[DockState.DockTop].DisplayingList.Count != 0)
{
rect.Y += (int)(DockArea.Height * DockTopPortion);
rect.Height -= (int)(DockArea.Height * DockTopPortion);
}
if (DockWindows[DockState.DockBottom].DisplayingList.Count != 0)
rect.Height -= (int)(DockArea.Height * DockBottomPortion);
return rect;
}
}
private DragHandler m_dragHandler;
internal DragHandler DragHandler
{
get { return m_dragHandler; }
}
private Control m_dummyControl;
internal Control DummyControl
{
get { return m_dummyControl; }
}
private FloatWindowCollection m_floatWindows;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="FloatWindows"]/*' />
[Browsable(false)]
public FloatWindowCollection FloatWindows
{
get { return m_floatWindows; }
}
private bool m_mdiIntegration = true;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="MdiIntegration"]/*' />
[LocalizedCategory("Category.Docking")]
[LocalizedDescription("DockPanel.MdiIntegration.Description")]
[DefaultValue(true)]
public bool MdiIntegration
{
get { return m_mdiIntegration; }
set
{
if (value == m_mdiIntegration)
return;
m_mdiIntegration = value;
RefreshMdiIntegration();
}
}
private bool m_sdiDocument = false;
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Property[@name="SdiDocument"]/*' />
[LocalizedCategory("Category.Docking")]
[LocalizedDescription("DockPanel.SdiDocument.Description")]
[DefaultValue(false)]
public bool SdiDocument
{
get { return m_sdiDocument; }
set
{
if (value == m_sdiDocument)
return;
m_sdiDocument = value;
Refresh();
}
}
/// <exclude/>
protected override void OnLayout(LayoutEventArgs levent)
{
AutoHideStripControl.Bounds = ClientRectangle;
CalculateDockPadding();
int width = ClientRectangle.Width - DockPadding.Left - DockPadding.Right;
int height = ClientRectangle.Height - DockPadding.Top - DockPadding.Bottom;
int dockLeftSize = (int)(width * m_dockLeftPortion);
int dockRightSize = (int)(width * m_dockRightPortion);
int dockTopSize = (int)(height * m_dockTopPortion);
int dockBottomSize = (int)(height * m_dockBottomPortion);
if (dockLeftSize < MeasurePane.MinSize)
dockLeftSize = MeasurePane.MinSize;
if (dockRightSize < MeasurePane.MinSize)
dockRightSize = MeasurePane.MinSize;
if (dockTopSize < MeasurePane.MinSize)
dockTopSize = MeasurePane.MinSize;
if (dockBottomSize < MeasurePane.MinSize)
dockBottomSize = MeasurePane.MinSize;
DockWindows[DockState.DockLeft].Width = dockLeftSize;
DockWindows[DockState.DockRight].Width = dockRightSize;
DockWindows[DockState.DockTop].Height = dockTopSize;
DockWindows[DockState.DockBottom].Height = dockBottomSize;
AutoHideWindow.Bounds = AutoHideWindowBounds;
DockWindows[DockState.Document].BringToFront();
AutoHideWindow.BringToFront();
base.OnLayout(levent);
}
internal Rectangle GetTabStripRectangle(DockState dockState)
{
return AutoHideStripControl.GetTabStripRectangle(dockState);
}
/// <exclude/>
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.FillRectangle(SystemBrushes.AppWorkspace, ClientRectangle);
}
internal void AddContent(DockContent content)
{
if (content == null)
throw(new ArgumentNullException());
if (!Contents.Contains(content))
{
Contents.Add(content);
OnContentAdded(new DockContentEventArgs(content));
}
}
internal void AddPane(DockPane pane)
{
if (Panes.Contains(pane))
return;
Panes.Add(pane);
}
internal void AddFloatWindow(FloatWindow floatWindow)
{
if (FloatWindows.Contains(floatWindow))
return;
FloatWindows.Add(floatWindow);
}
private void CalculateDockPadding()
{
DockPadding.All = 0;
int height = AutoHideStripControl.MeasureHeight();
if (AutoHideStripControl.GetPanes(DockState.DockLeftAutoHide).Count > 0)
DockPadding.Left = height;
if (AutoHideStripControl.GetPanes(DockState.DockRightAutoHide).Count > 0)
DockPadding.Right = height;
if (AutoHideStripControl.GetPanes(DockState.DockTopAutoHide).Count > 0)
DockPadding.Top = height;
if (AutoHideStripControl.GetPanes(DockState.DockBottomAutoHide).Count > 0)
DockPadding.Bottom = height;
}
internal Rectangle AutoHideWindowBounds
{
get
{
DockState state = AutoHideWindow.DockState;
Rectangle rectDockArea = DockArea;
if (ActiveAutoHideContent == null)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?