本文整理汇总了C#中WeifenLuo.WinFormsUI.Docking.DockPanel.SuspendLayout方法的典型用法代码示例。如果您正苦于以下问题:C# DockPanel.SuspendLayout方法的具体用法?C# DockPanel.SuspendLayout怎么用?C# DockPanel.SuspendLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeifenLuo.WinFormsUI.Docking.DockPanel
的用法示例。
在下文中一共展示了DockPanel.SuspendLayout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
public void Show(DockPanel dockPanel, Rectangle floatWindowBounds)
{
if (dockPanel == null)
throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
dockPanel.SuspendLayout(true);
DockPanel = dockPanel;
if (FloatPane == null)
{
IsHidden = true; // to reduce the screen flicker
FloatPane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, false);
FloatPane.FloatWindow.StartPosition = FormStartPosition.Manual;
}
FloatPane.FloatWindow.Bounds = floatWindowBounds;
Show(dockPanel, DockState.Float);
Activate();
dockPanel.ResumeLayout(true, true);
}
示例2: LoadFromXml
public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
{
if (dockPanel.Contents.Count != 0)
throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
XmlTextReader xmlIn = new XmlTextReader(stream);
xmlIn.WhitespaceHandling = WhitespaceHandling.None;
xmlIn.MoveToContent();
while (!xmlIn.Name.Equals("DockPanel"))
{
if (!MoveToNextElement(xmlIn))
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
}
string formatVersion = xmlIn.GetAttribute("FormatVersion");
if (!IsFormatVersionValid(formatVersion))
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
DockPanelStruct dockPanelStruct = new DockPanelStruct();
dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture);
dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);
// Load Contents
MoveToNextElement(xmlIn);
if (xmlIn.Name != "Contents")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
ContentStruct[] contents = LoadContents(xmlIn);
// Load Panes
if (xmlIn.Name != "Panes")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
PaneStruct[] panes = LoadPanes(xmlIn);
// Load DockWindows
if (xmlIn.Name != "DockWindows")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);
// Load FloatWindows
if (xmlIn.Name != "FloatWindows")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);
if (closeStream)
xmlIn.Close();
dockPanel.SuspendLayout(true);
dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion;
dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion;
dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion;
dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;
// Set DockWindow ZOrders
int prevMaxDockWindowZOrder = int.MaxValue;
for (int i = 0; i < dockWindows.Length; i++)
{
int maxDockWindowZOrder = -1;
int index = -1;
for (int j = 0; j < dockWindows.Length; j++)
{
if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
{
maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
index = j;
}
}
dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
prevMaxDockWindowZOrder = maxDockWindowZOrder;
}
// Create Contents
for (int i = 0; i < contents.Length; i++)
{
IDockContent content = deserializeContent(contents[i].PersistString);
if (content == null)
content = new DummyContent();
content.DockHandler.DockPanel = dockPanel;
content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
content.DockHandler.IsHidden = true;
content.DockHandler.IsFloat = contents[i].IsFloat;
}
// Create panes
for (int i = 0; i < panes.Length; i++)
{
DockPane pane = null;
for (int j = 0; j < panes[i].IndexContents.Length; j++)
{
IDockContent content = dockPanel.Contents[panes[i].IndexContents[j]];
if (j == 0)
pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false);
else if (panes[i].DockState == DockState.Float)
//.........这里部分代码省略.........
示例3: Show
public void Show(DockPanel dockPanel, DockState dockState)
{
if (dockPanel == null)
throw(new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
if (dockState == DockState.Unknown || dockState == DockState.Hidden)
throw(new ArgumentException(Strings.DockContentHandler_Show_InvalidDockState));
dockPanel.SuspendLayout(true);
DockPanel = dockPanel;
if (dockState == DockState.Float && FloatPane == null)
Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, true);
else if (PanelPane == null)
{
DockPane paneExisting = null;
foreach (DockPane pane in DockPanel.Panes)
if (pane.DockState == dockState)
{
paneExisting = pane;
break;
}
if (paneExisting == null)
Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true);
else
Pane = paneExisting;
}
DockState = dockState;
Activate();
dockPanel.ResumeLayout(true, true);
}
示例4: Initialize
// 初始化
public bool Initialize(DockPanel dockPanel)
{
// 加载配置界面
String applicationPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
String configFile = Path.Combine(Path.GetDirectoryName(applicationPath), "WorldEditor.DockPanel.config");
if (File.Exists(configFile))
{
DeserializeDockContent mDeserializeDockContent = new DeserializeDockContent(GetDockContentFromPersistString);
dockPanel.LoadFromXml(configFile, mDeserializeDockContent);
}
else
{
dockPanel.SuspendLayout(true);
this.mMainForm.Show(dockPanel, DockState.Document);
this.mWorldForm.Show(dockPanel, DockState.DockRight);
this.mSceneForm.Show(dockPanel, DockState.DockRight);
this.mEntityForm.Show(dockPanel, DockState.DockRight);
this.mTerrainForm.Show(dockPanel, DockState.DockRight);
this.mSettingForm.Show(dockPanel, DockState.DockRight);
this.mPropertyForm.Show(dockPanel, DockState.DockRight);
this.mOutputForm.Show(dockPanel, DockState.DockBottom);
dockPanel.ResumeLayout(true, true);
}
// 初始化操作接口
this.mWorldEditor = new WorldEditorFramework.MWorldEditor();
this.mWorldEditor.Initialize(this.mMainForm.Handle);
//***********
// 场景加载
this.mTerrainForm.OnSceneLoad();
this.mSettingForm.OnSceneLoad();
this.mSceneForm.OnSceneLoad();
//***********
return true;
}
示例5: Show
public void Show(DockPanel dockPanel, DockState dockState) {
if (dockPanel == null)
throw (new ArgumentNullException(Strings.DockContentHandler_Show_NullDockPanel));
if (dockState == DockState.Unknown || dockState == DockState.Hidden)
throw (new ArgumentException(Strings.DockContentHandler_Show_InvalidDockState));
dockPanel.SuspendLayout(true);
DockPanel = dockPanel;
DockPane paneExisting = null;
foreach (DockPane pane in DockPanel.Panes) {
if (pane.DockState != dockState) continue;
// I want BarDataRangePopup, BarScaleInterval, PositionSizePopup to open in their own floating windows
// without continue, the second popup is opened in the floating window of the first
// and window size for 2nd = size of 1st despite it was set upstack as Float.Bounds
if (pane.Contents.Contains(this.Content) == false) continue;
if (paneExisting == null || pane.IsActivated) paneExisting = pane;
if (pane.IsActivated) break;
}
if (dockState == DockState.Float) {
if (FloatPane == null) {
this.Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true);
} else {
// I don't understand "Activated"/Hidden" but I've found a
// deserialized restored (hidden) Pane for BarDataRangePopup, BarScaleInterval, PositionSizePopup
this.Pane = FloatPane;
//this.Pane = (paneExisting != null) ? paneExisting
// : DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true);
}
} else if (PanelPane == null) {
this.Pane = (paneExisting != null) ? paneExisting
: DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true);
}
DockState = dockState;
dockPanel.ResumeLayout(true, true); //we'll resume the layout before activating to ensure that the position
Activate(); //and size of the form are finally processed before the form is shown
}
示例6: LoadFromXml
public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream) {
if (dockPanel.Contents.Count != 0)
throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
XmlTextReader xmlIn = new XmlTextReader(stream);
xmlIn.WhitespaceHandling = WhitespaceHandling.None;
xmlIn.MoveToContent();
while (!xmlIn.Name.Equals("DockPanel")) {
if (!MoveToNextElement(xmlIn))
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
}
string formatVersion = xmlIn.GetAttribute("FormatVersion");
if (!IsFormatVersionValid(formatVersion))
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
DockPanelStruct dockPanelStruct = new DockPanelStruct();
dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture);
dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);
// Load Contents
MoveToNextElement(xmlIn);
if (xmlIn.Name != "Contents")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
ContentStruct[] contents = LoadContents(xmlIn);
// Load Panes
if (xmlIn.Name != "Panes")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
PaneStruct[] panes = LoadPanes(xmlIn);
// Load DockWindows
if (xmlIn.Name != "DockWindows")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);
// Load FloatWindows
if (xmlIn.Name != "FloatWindows")
throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);
if (closeStream)
xmlIn.Close();
dockPanel.SuspendLayout(true);
dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion;
dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion;
dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion;
dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;
// Set DockWindow ZOrders
int prevMaxDockWindowZOrder = int.MaxValue;
for (int i = 0; i < dockWindows.Length; i++) {
int maxDockWindowZOrder = -1;
int index = -1;
for (int j = 0; j < dockWindows.Length; j++) {
if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder) {
maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
index = j;
}
}
dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
prevMaxDockWindowZOrder = maxDockWindowZOrder;
}
// Create Contents
for (int i = 0; i < contents.Length; i++) {
IDockContent content = deserializeContent(contents[i].PersistString);
if (content == null) content = new DummyContent();
content.DockHandler.DockPanel = dockPanel;
content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
// "avoiding flickering" will cause "exception" at DockPane.cs:153 that I screened
// and global failure of LoadXml()
//content.DockHandler.IsHidden = true;
content.DockHandler.IsHidden = false;
content.DockHandler.IsFloat = contents[i].IsFloat;
}
// Create panes
for (int i = 0; i < panes.Length; i++) {
DockPane pane = null;
PaneStruct paneStruct = panes[i];
for (int j = 0; j < paneStruct.IndexContents.Length; j++) {
try {
int idx = paneStruct.IndexContents[j];
IDockContent content = dockPanel.Contents[idx];
if (content == null || content.DockHandler == null) {
string msg = "avoiding exception";
continue;
}
if (j == 0)
pane = dockPanel.DockPaneFactory.CreateDockPane(content, paneStruct.DockState, false);
else if (paneStruct.DockState == DockState.Float)
//.........这里部分代码省略.........
示例7: RestoreDockPanel
public static void RestoreDockPanel(DockPanel dockPanel, XmlTextReader xmlIn, DockPanelExt.DeserializeDockContentDelegate deserializeDockContent)
{
if (xmlIn.Name != "DockPanel")
throw new ArgumentException("Invalid Xml Format");
var dockPanelStruct = new DockPanelStruct();
dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture);
dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);
// Load Contents
MoveToNextElement(xmlIn);
if (xmlIn.Name != "Contents")
throw new ArgumentException("Invalid Xml Format");
ContentStruct[] contents = LoadAndCreateContents(dockPanel, xmlIn, deserializeDockContent);
// Load Panes
MoveToNextElement(xmlIn);
if (xmlIn.Name != "Panes")
throw new ArgumentException("Invalid Xml Format");
PaneStruct[] panes = LoadPanes(xmlIn);
// Load DockWindows
MoveToNextElement(xmlIn);
if (xmlIn.Name != "DockWindows")
throw new ArgumentException("Invalid Xml Format");
DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);
// Load FloatWindows
MoveToNextElement(xmlIn);
if (xmlIn.Name != "FloatWindows")
throw new ArgumentException("Invalid Xml Format");
FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);
dockPanel.SuspendLayout(true);
dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion;
dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion;
dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion;
dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;
// Set DockWindow ZOrders
int prevMaxDockWindowZOrder = int.MaxValue;
for (int i = 0; i < dockWindows.Length; i++)
{
int maxDockWindowZOrder = -1;
int index = -1;
for (int j = 0; j < dockWindows.Length; j++)
{
if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
{
maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
index = j;
}
}
dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
prevMaxDockWindowZOrder = maxDockWindowZOrder;
}
// Create panes
foreach (PaneStruct t in panes)
{
DockPane pane = null;
for (int j = 0; j < t.IndexContents.Length; j++)
{
IDockContent content = dockPanel.Contents[t.IndexContents[j]];
if (j == 0)
pane = dockPanel.DockPaneFactory.CreateDockPane(content, t.DockState, false);
else if (t.DockState == DockState.Float)
content.DockHandler.FloatPane = pane;
else
content.DockHandler.PanelPane = pane;
}
}
// Assign Panes to DockWindows
foreach (DockWindowStruct t in dockWindows)
{
for (int j = 0; j < t.NestedPanes.Length; j++)
{
DockWindow dw = dockPanel.DockWindows[t.DockState];
int indexPane = t.NestedPanes[j].IndexPane;
DockPane pane = dockPanel.Panes[indexPane];
int indexPrevPane = t.NestedPanes[j].IndexPrevPane;
DockPane prevPane = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane];
DockAlignment alignment = t.NestedPanes[j].Alignment;
double proportion = t.NestedPanes[j].Proportion;
pane.DockTo(dw, prevPane, alignment, proportion);
if (panes[indexPane].DockState == dw.DockState)
panes[indexPane].ZOrderIndex = t.ZOrderIndex;
}
}
// Create float windows
foreach (FloatWindowStruct t in floatWindows)
//.........这里部分代码省略.........