internal void AddCheckBoxColumn() { Column item = new Column(this.tabList) { ID = 0, Name = this.tabList.checkboxName, IsNumber = false, SmallToBig = false, DisplayName = this.tabList.checkboxDisplayName, MinWidth = this.tabList.checkboxWidth, Editable = true, ColumnTextList = new FreeTextList() }; item.ColumnTextList.Align = TextAlign.Middle; item.Text.Text = this.tabList.checkboxDisplayName; item.Text.Position = new Microsoft.Xna.Framework.Rectangle(item.Text.Position.X, item.Text.Position.Y, this.tabList.checkboxWidth, item.Text.Position.Height); this.AllColumns.Add(item); foreach (Tab tab in this.Tabs) { if (!tab.Columns[0].Editable) { tab.Columns.Insert(0, item); tab.ReCalculate(tab.CurrentYOffset); } } }
public void LoadFromXMLNode(XmlNode rootNode) { XmlNode node = rootNode.ChildNodes.Item(0); foreach (XmlNode node2 in node.ChildNodes) { Font font; Microsoft.Xna.Framework.Graphics.Color color; Column column; column = new Column(this.tabList) { //读取列 ID = int.Parse(node2.Attributes.GetNamedItem("ID").Value), Name = node2.Attributes.GetNamedItem("Name").Value, IsNumber = bool.Parse(node2.Attributes.GetNamedItem("IsNumber").Value), DisplayName = node2.Attributes.GetNamedItem("DisplayName").Value, MinWidth = int.Parse(node2.Attributes.GetNamedItem("MinWidth").Value), //SmallToBig = !column.IsNumber SmallToBig=true //SmallToBig = !(bool.Parse(node2.Attributes.GetNamedItem("IsNumber").Value)) }; //column.SmallToBig = !column.IsNumber; //我添加的 StaticMethods.LoadFontAndColorFromXMLNode(node2, out font, out color); column.ColumnTextList = new FreeTextList(this.tabList.graphicsDevice, font); column.ColumnTextList.TextColor = color; //column.ColumnTextList.TextColor =new Microsoft.Xna.Framework.Graphics.Color (0.5f,0.5f,0.5f); column.ColumnTextList.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node2.Attributes.GetNamedItem("Align").Value); column.Text.Text = column.DisplayName; this.AllColumns.Add(column); } node = rootNode.ChildNodes.Item(1); this.tabMargin = int.Parse(node.Attributes.GetNamedItem("Margin").Value); foreach (XmlNode node2 in node.ChildNodes) //读取tab { Tab item = new Tab(this.tabList, this) { ID = int.Parse(node2.Attributes.GetNamedItem("ID").Value), Name = node2.Attributes.GetNamedItem("Name").Value, DisplayName = node2.Attributes.GetNamedItem("DisplayName").Value }; if (node2.Attributes.GetNamedItem("ListKind") != null) { item.ListKind = node2.Attributes.GetNamedItem("ListKind").Value; } if (node2.Attributes.GetNamedItem("ListMethod") != null) { item.ListMethod = node2.Attributes.GetNamedItem("ListMethod").Value; } item.LoadColumnsFromString(node2.Attributes.GetNamedItem("Columns").Value); if (node2.Attributes.GetNamedItem("SortColumnID") != null) { item.SortColumnID = int.Parse(node2.Attributes.GetNamedItem("SortColumnID").Value); } if (node2.Attributes.GetNamedItem("SmallToBig") != null) { item.SmallToBig = bool.Parse(node2.Attributes.GetNamedItem("SmallToBig").Value); } item.Text.Text = item.DisplayName; this.Tabs.Add(item); } }