示例#1
0
        public static Lbl AddLabel(Control ctrl, string text, int d, bool moveCtrl, int labelWidth)
        {
            // Create a new label
            Lbl label = new Lbl(text, ctrl.Parent);

            // Set its width
            if (labelWidth != 0)
            {
                label.Size = new Size(labelWidth, label.Height);
            }

            // Give it the right position
            if (moveCtrl)
            {
                label.LocateFrom(ctrl, Horizontal.CopyLeft, Vertical.Middle, d);
                LocateFrom(ctrl, label, Horizontal.Right, Vertical.Middle, d);
            }
            else
            {
                label.LocateFrom(ctrl, Horizontal.Left, Vertical.Middle, d);
            }

            // Return the label, for the sake of easyness
            return(label);
        }
示例#2
0
 /// <summary>
 /// Add a label to this control
 /// </summary>
 /// <param name="text">The text of the label</param>
 /// <param name="d">The distance between the label and the control</param>
 /// <param name="moveCtrl">Whether the control should be moved or not</param>
 /// <param name="labelWidth">The width of the label. Set to 0 to keep the original width</param>
 public void AddLabel(string text, int d = Btn.distance, bool moveCtrl = true, int labelWidth = 0)
 {
     if (this.Label != null)
     {
         this.Parent.Controls.Remove(this.Label);
     }
     this.Label = Btn.AddLabel(this, text, d, moveCtrl, labelWidth);
 }
示例#3
0
        public static Lbl AddLabel(Control ctrl, string text, int d, bool moveCtrl, int labelWidth)
        {
            // Create a new label
            Lbl label = new Lbl(text, ctrl.Parent);

            // Set its width
            if (labelWidth != 0)
                label.Size = new Size(labelWidth, label.Height);

            // Give it the right position
            if (moveCtrl) {
                label.LocateFrom(ctrl, Horizontal.CopyLeft, Vertical.Middle, d);
                LocateFrom(ctrl, label, Horizontal.Right, Vertical.Middle, d);
            }
            else {
                label.LocateFrom(ctrl, Horizontal.Left, Vertical.Middle, d);
            }

            // Return the label, for the sake of easyness
            return label;
        }
示例#4
0
 /// <summary>
 /// Add a label to this control
 /// </summary>
 /// <param name="text">The text of the label</param>
 /// <param name="d">The distance between the label and the control</param>
 /// <param name="moveCtrl">Whether the control should be moved or not</param>
 /// <param name="labelWidth">The width of the label. Set to 0 to keep the original width</param>
 public void AddLabel(string text, int d = Btn.distance, bool moveCtrl = true, int labelWidth = 0)
 {
     if (this.Label != null)
         this.Parent.Controls.Remove(this.Label);
     this.Label = Btn.AddLabel(this, text, d, moveCtrl, labelWidth);
 }