本文整理汇总了C#中WeifenLuo.WinFormsUI.Docking.DockPane.SetContentIndex方法的典型用法代码示例。如果您正苦于以下问题:C# DockPane.SetContentIndex方法的具体用法?C# DockPane.SetContentIndex怎么用?C# DockPane.SetContentIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeifenLuo.WinFormsUI.Docking.DockPane
的用法示例。
在下文中一共展示了DockPane.SetContentIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
public void Show(DockPane pane, IDockContent beforeContent)
{
if (pane == null)
throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullPane));
if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1)
throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidBeforeContent));
pane.DockPanel.SuspendLayout(true);
DockPanel = pane.DockPanel;
Pane = pane;
pane.SetContentIndex(Content, pane.Contents.IndexOf(beforeContent));
Show();
pane.DockPanel.ResumeLayout(true, true);
}
示例2: DockTo
public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
{
if (dockStyle == DockStyle.Fill)
{
bool samePane = (Pane == pane);
if (!samePane)
Pane = pane;
if (contentIndex == -1 || !samePane)
pane.SetContentIndex(Content, contentIndex);
else
{
DockContentCollection contents = pane.Contents;
int oldIndex = contents.IndexOf(Content);
int newIndex = contentIndex;
if (oldIndex < newIndex)
{
newIndex += 1;
if (newIndex > contents.Count -1)
newIndex = -1;
}
pane.SetContentIndex(Content, newIndex);
}
}
else
{
DockPane paneFrom = DockPanel.DockPaneFactory.CreateDockPane(Content, pane.DockState, true);
INestedPanesContainer container = pane.NestedPanesContainer;
if (dockStyle == DockStyle.Left)
paneFrom.DockTo(container, pane, DockAlignment.Left, 0.5);
else if (dockStyle == DockStyle.Right)
paneFrom.DockTo(container, pane, DockAlignment.Right, 0.5);
else if (dockStyle == DockStyle.Top)
paneFrom.DockTo(container, pane, DockAlignment.Top, 0.5);
else if (dockStyle == DockStyle.Bottom)
paneFrom.DockTo(container, pane, DockAlignment.Bottom, 0.5);
paneFrom.DockState = pane.DockState;
}
}
示例3: DockTo
public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
{
if (dockStyle == DockStyle.Fill)
{
IDockContent activeContent = ActiveContent;
for (int i = Contents.Count - 1; i >= 0; i--)
{
IDockContent c = Contents[i];
if (c.DockHandler.DockState == DockState)
{
c.DockHandler.Pane = pane;
if (contentIndex != -1)
pane.SetContentIndex(c, contentIndex);
}
}
pane.ActiveContent = activeContent;
}
else
{
if (dockStyle == DockStyle.Left)
DockTo(pane.NestedPanesContainer, pane, DockAlignment.Left, 0.5);
else if (dockStyle == DockStyle.Right)
DockTo(pane.NestedPanesContainer, pane, DockAlignment.Right, 0.5);
else if (dockStyle == DockStyle.Top)
DockTo(pane.NestedPanesContainer, pane, DockAlignment.Top, 0.5);
else if (dockStyle == DockStyle.Bottom)
DockTo(pane.NestedPanesContainer, pane, DockAlignment.Bottom, 0.5);
DockState = pane.DockState;
}
}
示例4: DockTo
public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
{
if (dockStyle == DockStyle.Fill)
{
for (int i = NestedPanes.Count - 1; i >= 0; i--)
{
DockPane paneFrom = NestedPanes[i];
for (int j = paneFrom.Contents.Count - 1; j >= 0; j--)
{
IDockContent c = paneFrom.Contents[j];
c.DockHandler.Pane = pane;
if (contentIndex != -1)
pane.SetContentIndex(c, contentIndex);
c.DockHandler.Activate();
}
}
}
else
{
DockAlignment alignment = DockAlignment.Left;
if (dockStyle == DockStyle.Left)
alignment = DockAlignment.Left;
else if (dockStyle == DockStyle.Right)
alignment = DockAlignment.Right;
else if (dockStyle == DockStyle.Top)
alignment = DockAlignment.Top;
else if (dockStyle == DockStyle.Bottom)
alignment = DockAlignment.Bottom;
MergeNestedPanes(VisibleNestedPanes, pane.NestedPanesContainer.NestedPanes, pane, alignment, 0.5);
}
}
示例5: DockTo
public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
{
if (dockStyle == DockStyle.Fill)
{
bool samePane = (Pane == pane);
if (!samePane)
Pane = pane;
int visiblePanes = 0;
int convertedIndex = 0;
while (visiblePanes <= contentIndex && convertedIndex < Pane.Contents.Count)
{
DockContent window = Pane.Contents[convertedIndex] as DockContent;
if (window != null && !window.IsHidden)
++visiblePanes;
++convertedIndex;
}
contentIndex = Math.Min(Math.Max(0, convertedIndex-1), Pane.Contents.Count - 1);
if (contentIndex == -1 || !samePane)
pane.SetContentIndex(Content, contentIndex);
else
{
DockContentCollection contents = pane.Contents;
int oldIndex = contents.IndexOf(Content);
int newIndex = contentIndex;
if (oldIndex < newIndex)
{
newIndex += 1;
if (newIndex > contents.Count -1)
newIndex = -1;
}
pane.SetContentIndex(Content, newIndex);
}
}
else
{
DockPane paneFrom = DockPanel.DockPaneFactory.CreateDockPane(Content, pane.DockState, true);
INestedPanesContainer container = pane.NestedPanesContainer;
if (dockStyle == DockStyle.Left)
paneFrom.DockTo(container, pane, DockAlignment.Left, 0.5);
else if (dockStyle == DockStyle.Right)
paneFrom.DockTo(container, pane, DockAlignment.Right, 0.5);
else if (dockStyle == DockStyle.Top)
paneFrom.DockTo(container, pane, DockAlignment.Top, 0.5);
else if (dockStyle == DockStyle.Bottom)
paneFrom.DockTo(container, pane, DockAlignment.Bottom, 0.5);
paneFrom.DockState = pane.DockState;
}
}