public static DockPanel CreateDockPanel(XMLDockPanel xmlItem, DockManager dockManager) { DockPanel dockPanel = null; dockPanel = AddDockPanel(GetDockStyleFormXml(xmlItem.ItemDockStyle), dockManager); if (dockPanel.Dock == DockingStyle.Float) { int x = Convert.ToInt32(xmlItem.ItemFloatLocation.Split(",".ToCharArray()).ToList()[0]); int y = Convert.ToInt32(xmlItem.ItemFloatLocation.Split(",".ToCharArray()).ToList()[1]); dockPanel.FloatLocation = new System.Drawing.Point(x, y); int width = Convert.ToInt32(xmlItem.ItemSize.Split(",".ToCharArray()).ToList()[0]); int height = Convert.ToInt32(xmlItem.ItemSize.Split(",".ToCharArray()).ToList()[1]); dockPanel.Size = new System.Drawing.Size(); } else { dockPanel.FloatLocation = dockPanel.Location; dockPanel.FloatSize = dockPanel.Size; } dockPanel.Name = xmlItem.ItemBindControl; dockPanel.Text = xmlItem.ItemText; dockPanel.Visibility = xmlItem.ItemVisible == "true" ? DockVisibility.Visible : DockVisibility.Hidden; //dockPanel.Tag = new { Form = xmlItem.ItemForm, Dll = xmlItem.ItemDllPath, Control = xmlItem.ItemBindControl }; dockPanel.ControlContainer.Controls.Add(CreateControl(xmlItem.ItemBindControl, xmlItem.ItemDllPath)); return dockPanel; }
public static XMLDockPanel GetXMLDockPanel(XmlNode xmlNode) { XMLDockPanel item = new XMLDockPanel(xmlNode); item.ItemName = xmlNode.Name; item.ItemDockStyle = NodeAttr.GetSetNodeAttrValue(xmlNode, DockStyleStr, ""); item.ItemText = NodeAttr.GetSetNodeAttrValue(xmlNode, Text, Guid.NewGuid() + ""); item.ItemVisible = NodeAttr.GetSetNodeAttrValue(xmlNode, Visible, "true"); item.ItemForm = NodeAttr.GetSetNodeAttrValue(xmlNode, Form, ""); // item.ItemDllPath = NodeAttr.GetSetNodeAttrValue(xmlNode, DllPath, ""); item.ItemBindControl = NodeAttr.GetSetNodeAttrValue(xmlNode, BindControl); item.ItemFloatLocation = NodeAttr.GetSetNodeAttrValue(xmlNode, FloatLocation, "0,0"); item.ItemSize = NodeAttr.GetSetNodeAttrValue(xmlNode, Size, "0,0"); return item; }