Exemplo n.º 1
0
 private static void writeXmlToolBarPos(XmlTextWriter xw, ToolBarPos toolBarPos)
 {
     writeElement(xw, "Direction", toolBarPos.Direction.ToString());
     xw.WriteStartElement("Location");
     writeElement(xw, "X", toolBarPos.Location.X);
     writeElement(xw, "Y", toolBarPos.Location.Y);
     xw.WriteEndElement();
 }
Exemplo n.º 2
0
        /// <summary>
        /// 位置を比較する(ソート用)
        /// </summary>
        public int CompareTo(object obj)
        {
            ToolBarPos pos = obj as ToolBarPos;

            if (pos == null)
            {
                throw new ArgumentException("引数がToolBarPos型ではありません");
            }

            int comp = this.Location.Y.CompareTo(pos.Location.Y);               //縦を比較する

            if (comp == 0)
            {
                comp = this.Location.X.CompareTo(pos.Location.X);                       //縦が同じ時は横で比較する
            }
            return(comp);
        }
Exemplo n.º 3
0
        /// <summary>
        /// XmlElementからToolBarPos情報を取得する
        /// element例:
        /// <ToolBarViewPos>
        ///   <Direction>Top</Direction>
        ///   <Location>
        ///     <X>564</X>
        ///     <Y>0</Y>
        ///   </Location>
        /// </ToolBarViewPos>
        /// </summary>
        /// <param name="toolBarElement"></param>
        /// <returns></returns>
        private static ToolBarPos getToolBarPosFromXmlElement(XmlElement toolBarElement)
        {
            ToolBarPos toolBarPos = new ToolBarPos();

            foreach (XmlElement element in toolBarElement.ChildNodes)
            {
                switch (element.Name)
                {
                case "Direction":
                    toolBarPos.Direction = (ToolBarDirection)Enum.Parse(typeof(ToolBarDirection), element.InnerText);
                    break;

                case "Location":
                    toolBarPos.Location = getPointFromXmlElement(element);
                    break;
                }
            }

            return(toolBarPos);
        }