本文整理汇总了C#中WeifenLuo.WinFormsUI.Docking.DockPanel.DocumentsToArray方法的典型用法代码示例。如果您正苦于以下问题:C# DockPanel.DocumentsToArray方法的具体用法?C# DockPanel.DocumentsToArray怎么用?C# DockPanel.DocumentsToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeifenLuo.WinFormsUI.Docking.DockPanel
的用法示例。
在下文中一共展示了DockPanel.DocumentsToArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloseAllDocuments
private static void CloseAllDocuments(DockPanel panel)
{
if (panel.DocumentStyle == DocumentStyle.SystemMdi)
{
throw new InvalidOperationException("cannot work in System MDI mode");
}
IDockContent[] documents = panel.DocumentsToArray();
foreach (IDockContent content in documents)
{
content.DockHandler.Close();
}
}
示例2: ShowAsDocumentTabNotPane
// protected override void OnLoad(EventArgs e) {
// if (base.ShowHint == DockState.Float) {
// //base.Size = this.FloatWindowRecommendedSize;
// this.Width = this.FloatWindowRecommendedSize.Width;
// this.Height = this.FloatWindowRecommendedSize.Height;
// base.FloatPane.ClientSize = this.FloatWindowRecommendedSize;
// Size a = base.FloatPane.PreferredSize;
// base.FloatPane.Size = this.FloatWindowRecommendedSize;
// }
// }
// protected override void OnActivated(EventArgs e) {
// if (base.ShowHint == DockState.Float) {
// //base.Size = this.FloatWindowRecommendedSize;
// this.Width = this.FloatWindowRecommendedSize.Width;
// this.Height = this.FloatWindowRecommendedSize.Height;
// base.FloatPane.ClientSize = this.FloatWindowRecommendedSize;
// Size a = base.FloatPane.PreferredSize;
// base.FloatPane.Size = this.FloatWindowRecommendedSize;
// }
// }
// public new void Show(DockPanel dp) {
// if (base.ShowHint == DockState.Float) {
// //base.Size = this.FloatWindowRecommendedSize;
// this.Width = this.FloatWindowRecommendedSize.Width;
// this.Height = this.FloatWindowRecommendedSize.Height;
// //base.FloatPane.ClientSize = this.FloatWindowRecommendedSize;
// //Size a = base.FloatPane.PreferredSize;
// //base.FloatPane.Size = this.FloatWindowRecommendedSize;
// }
// base.Show(dp);
// }
//http://msdn.microsoft.com/en-us/library/86faxx0d(v=vs.110).aspx
// Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
// public bool ApplicationExitOccured = false;
// void Application_ApplicationExit(object sender, EventArgs e) {
// this.ApplicationExitOccured = true;
// }
//
// public bool IsClosing = false;
// protected override void OnClosing(System.ComponentModel.CancelEventArgs e) {
// this.IsClosing = true;
// base.OnClosing(e);
// }
//
// // too late for ExceptionsControl.Splitter*.Distance to serialize
// public bool IsFormClosing = false;
// protected override void OnFormClosing(System.Windows.Forms.FormClosingEventArgs e) {
// this.IsFormClosing = true;
// base.OnFormClosing(e);
// }
//
// public bool IsFormClosed = false;
// protected override void OnFormClosed(System.Windows.Forms.FormClosedEventArgs e) {
// this.IsFormClosed = true;
// base.OnFormClosed(e);
// }
public void ShowAsDocumentTabNotPane(DockPanel dockPanel) {
var docs = dockPanel.DocumentsToArray();
if (docs.Length == 0) {
this.Show(dockPanel, DockState.Document);
return;
}
// add new tab, not a new pane besides existing one
foreach (IDockContent doc in docs) {
var hopefullyDockContent = doc as DockContent;
if (hopefullyDockContent == null) continue;
this.Show(hopefullyDockContent.Pane, null);
return;
}
this.Show(dockPanel, DockState.Document);
}