Exemplo n.º 1
0
 public int ResetAllOtherTabs(Tab tab)
 {
     int currentYOffset = 0;
     foreach (Tab tab2 in this.Tabs)
     {
         if ((tab2 != tab) && tab2.Selected)
         {
             currentYOffset = tab2.CurrentYOffset;
             tab2.ResetSelected();
         }
     }
     return currentYOffset;
 }
Exemplo n.º 2
0
        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);
            }
        }