当前位置: 首页>>代码示例>>C#>>正文


C# Control.SetPosition方法代码示例

本文整理汇总了C#中Flood.GUI.Controls.Control.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Control.SetPosition方法的具体用法?C# Control.SetPosition怎么用?C# Control.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Flood.GUI.Controls.Control的用法示例。


在下文中一共展示了Control.SetPosition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScrollControl

        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public ScrollControl(Control parent)
            : base(parent)
        {
            MouseInputEnabled = false;

            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 Control(this);
            m_InnerPanel.SetPosition(0, 0);
            m_InnerPanel.Margin = Margin.Five;
            m_InnerPanel.SendToBack();
            m_InnerPanel.MouseInputEnabled = false;

            m_AutoHideBars = false;
        }
开发者ID:chartly,项目名称:flood,代码行数:29,代码来源:ScrollControl.cs

示例2: CenterHorizontally

        /// <summary>
        /// Centers the control horizontally inside its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void CenterHorizontally(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(parent.Padding.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width) / 2), control.Y);
        }
开发者ID:tritao,项目名称:flood,代码行数:11,代码来源:Align.cs

示例3: AlignRight

        /// <summary>
        /// Moves the control to the right of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignRight(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(parent.Width - control.Width - parent.Padding.Right, control.Y);
        }
开发者ID:tritao,项目名称:flood,代码行数:11,代码来源:Align.cs

示例4: AlignLeft

        /// <summary>
        /// Moves the control to the left of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignLeft(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(parent.Padding.Left, control.Y);
        }
开发者ID:tritao,项目名称:flood,代码行数:11,代码来源:Align.cs

示例5: AlignBottom

        /// <summary>
        /// Moves the control to the bottom of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignBottom(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(control.X, parent.Height - control.Height);
        }
开发者ID:tritao,项目名称:flood,代码行数:11,代码来源:Align.cs

示例6: Center

 /// <summary>
 /// Centers the control inside its parent.
 /// </summary>
 /// <param name="control">Control to center.</param>
 public static void Center(Control control)
 {
     Control parent = control.Parent;
     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);
 }
开发者ID:tritao,项目名称:flood,代码行数:13,代码来源:Align.cs

示例7: CenterVertically

        /// <summary>
        /// Centers the control vertically inside its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void CenterVertically(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(control.X, (parent.Height - control.Height) / 2);
        }
开发者ID:tritao,项目名称:flood,代码行数:11,代码来源:Align.cs

示例8: AlignTop

 /// <summary>
 /// Moves the control to the top of its parent.
 /// </summary>
 /// <param name="control"></param>
 public static void AlignTop(Control control)
 {
     control.SetPosition(control.X, 0);
 }
开发者ID:tritao,项目名称:flood,代码行数:8,代码来源:Align.cs

示例9: PlaceRightBottom

 /// <summary>
 /// Places the control to the right of other control (bottom 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 PlaceRightBottom(Control control, Control anchor, int spacing = 0)
 {
     control.SetPosition(anchor.Right + spacing, anchor.Y - control.Height + anchor.Height);
 }
开发者ID:tritao,项目名称:flood,代码行数:10,代码来源:Align.cs

示例10: PlaceDownLeft

 /// <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(Control control, Control anchor, int spacing = 0)
 {
     control.SetPosition(anchor.X, anchor.Bottom + spacing);
 }
开发者ID:tritao,项目名称:flood,代码行数:10,代码来源:Align.cs


注:本文中的Flood.GUI.Controls.Control.SetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。