예제 #1
0
        /// <summary>
        /// Moves the control to the left of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignLeft(GUIControl control)
        {
            GUIControl parent = control.ParentControl;
            if (null == parent) return;

            control.SetPosition(parent.Padding.Left, control.Y);
        }
예제 #2
0
        /// <summary>
        /// Centers the control vertically inside its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void CenterVertically(GUIControl control)
        {
            GUIControl parent = control.ParentControl;
            if (null == parent) return;

            control.SetPosition(control.X, (parent.Height - control.Height) / 2);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public ScrollControl(ZGE.Components.ZComponent parent)
            : base(parent)
        {
            MouseInputEnabled = true;

            m_VerticalScrollBar = new VerticalScrollBar(this);
            m_VerticalScrollBar.Dock = Pos.Right;
            m_VerticalScrollBar.BarMoved += VBarMoved;
            m_CanScrollV = true;
            m_VerticalScrollBar.NudgeAmount = 30;

            m_HorizontalScrollBar = new HorizontalScrollBar(this);
            m_HorizontalScrollBar.Dock = Pos.Bottom;
            m_HorizontalScrollBar.BarMoved += HBarMoved;
            m_CanScrollH = true;
            m_HorizontalScrollBar.NudgeAmount = 30;

            m_InnerPanel = new GUIControl(this);
            m_InnerPanel.SetPosition(0, 0);
            m_InnerPanel.Margin = Margin.Five;
            m_InnerPanel.SendToBack();
            m_InnerPanel.MouseInputEnabled = false;

            m_AutoHideBars = false;
        }
예제 #4
0
        /// <summary>
        /// Moves the control to the right of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignRight(GUIControl control)
        {
            GUIControl parent = control.ParentControl;
            if (null == parent) return;


            control.SetPosition(parent.Width - control.Width - parent.Padding.Right, control.Y);
        }
예제 #5
0
        /// <summary>
        /// Centers the control horizontally inside its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void CenterHorizontally(GUIControl control)
        {
            GUIControl parent = control.ParentControl;
            if (null == parent) return;


            control.SetPosition(parent.Padding.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width) / 2), control.Y);
        }
예제 #6
0
 /// <summary>
 /// Centers the control inside its parent.
 /// </summary>
 /// <param name="control">Control to center.</param>
 public static void Center(GUIControl control)
 {
     GUIControl parent = control.ParentControl;
     if (parent == null) 
         return;
     control.SetPosition(
         parent.Padding.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width)/2),
         (parent.Height - control.Height)/2);
 }
예제 #7
0
        /// <summary>
        /// Moves the control to the bottom of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignBottom(GUIControl control)
        {
            GUIControl parent = control.ParentControl;
            if (null == parent) return;

            control.SetPosition(control.X, parent.Height - control.Height);
        }
예제 #8
0
 /// <summary>
 /// Moves the control to the top of its parent.
 /// </summary>
 /// <param name="control"></param>
 public static void AlignTop(GUIControl control)
 {
     control.SetPosition(control.X, 0);
 }
예제 #9
0
 public static void PlaceRightBottom(GUIControl control, GUIControl anchor, int spacing)
 {
     control.SetPosition(anchor.Right + spacing, anchor.Y - control.Height + anchor.Height);
 }
예제 #10
0
 /// <summary>
 /// Places the control below other control (left aligned), taking margins into account.
 /// </summary>
 /// <param name="control">Control to place.</param>
 /// <param name="anchor">Anchor control.</param>
 /// <param name="spacing">Optional spacing.</param>
 public static void PlaceDownLeft(GUIControl control, GUIControl anchor, int spacing)
 {
     control.SetPosition(anchor.X, anchor.Bottom + spacing);
 }