public MassRenameControl() { // The controls this.tbBrowse = new Tb(this); this.btnBrowseFiles = new Btn("Browse files", this); this.btnBrowseFiles.Click += this.browseFiles; this.btnBrowseDir = new Btn("Browse dir", this); this.btnBrowseDir.Click += this.browseDir; this.btnRename = new Btn("Rename", this); this.btnRename.Click += this.rename; int color = 250; this.tbOld = new RichTb(this); this.tbOld.ReadOnly = true; this.tbOld.BackColor = Color.FromArgb(color, color, color); this.tbOld.ForeColor = Color.Black; this.tbNew = new RichTb(this); this.tbNew.BackColor = Color.FromArgb(color, color, color); this.tbNew.ForeColor = Color.Black; }
public static void LocateFrom(Control ctrl, Control c, Btn.Horizontal h, Btn.Vertical v, int d) { int x = 0; int y = 0; if (h == Horizontal.Left) x = c.Location.X - ctrl.Size.Width - d; if (h == Horizontal.CopyLeft) x = c.Location.X; if (h == Horizontal.Center) x = c.Location.X + (c.Size.Width - ctrl.Size.Width) / 2; if (h == Horizontal.CopyRight) x = c.Location.X + c.Size.Width - ctrl.Size.Width; if (h == Horizontal.Right) x = c.Location.X + c.Size.Width + d; if (v == Vertical.Top) y = c.Location.Y - ctrl.Size.Height - d; if (v == Vertical.CopyTop) y = c.Location.Y; if (v == Vertical.Middle) y = c.Location.Y + (c.Size.Height - ctrl.Size.Height) / 2; if (v == Vertical.CopyBottom) y = c.Location.Y + c.Size.Height - ctrl.Size.Height; if (v == Vertical.Bottom) y = c.Location.Y + c.Size.Height + d; ctrl.Location = new Point(x, y); }
/// <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); }
public MassRenameControl() { // The controls this.tbBrowse = new Tb(this); this.btnBrowseFiles = new Btn("Browse files", this); this.btnBrowseFiles.Click += this.browseFiles; this.btnBrowseDir = new MassRename.Btn("Browse dir", this); this.btnBrowseDir.Click += this.browseDir; this.btnRename = new Btn("Rename", this); this.btnRename.Click += this.rename; int color = 250; this.tbOld = new RichTb(this); this.tbOld.ReadOnly = true; this.tbOld.BackColor = Color.FromArgb(color, color, color); this.tbOld.ForeColor = Color.Black; this.tbNew = new RichTb(this); this.tbNew.BackColor = Color.FromArgb(color, color, color); this.tbNew.ForeColor = Color.Black; }
/// <summary> /// Locate this control adjacent to the other control in a specific way /// </summary> /// <param name="c">The other control</param> /// <param name="h">The horizontal placement</param> /// <param name="v">The vertical placement</param> /// <param name="distance">The margin</param> public void LocateFrom(Control c, Btn.Horizontal h = Btn.Horizontal.CopyLeft, Btn.Vertical v = Btn.Vertical.CopyTop, int d = Btn.distance) { Btn.LocateFrom(this, c, h, v, d); }
/// <summary> /// Locate this control inside its parent in a specific way /// </summary> /// <param name="c">It's parent</param> /// <param name="h">The horizontal placement</param> /// <param name="v">The vertical placement</param> /// <param name="distance">The margin</param> public void LocateInside(Control c, Btn.Horizontal h = Btn.Horizontal.Left, Btn.Vertical v = Btn.Vertical.Top, int d = Btn.distance) { Btn.LocateInside(this, c, h, v, d); }