/// <summary> /// Detach from events. /// </summary> /// <param name="control"></param> protected override void OnUnsubscribeControlEvents(Control control) { base.OnUnsubscribeControlEvents(control); TrackBarEx trackBar = control as TrackBarEx; trackBar.ValueChanged -= new EventHandler(trackBar_ValueChanged); }
/// <summary> /// Create the actual control, note this is static so it can be called from the /// constructor. /// /// </summary> /// <returns></returns> private static Control CreateControlInstance() { TrackBarEx t = new TrackBarEx(); t.AutoSize = false; t.Height = 16; // Add other initialization code here. return(t); }
public Main() { ToolTipAdv tooltip = null; TrackBarEx trackBar = new TrackBarEx(); InitializeComponent(); tooltip = new ToolTipAdv(this); tooltip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(225))))); foreach (CaptionImage image in this.CaptionImages) { if (image.Name == "CaptionImage6") { image.Location = new Point(this.Width - 34, 4); } else if (image.Name == "CaptionImage7") { image.Location = new Point(this.Width - 63, 4); } else if (image.Name == "CaptionImage8") { image.Location = new Point(this.Width - 87, 4); } if (image.Name == "CaptionImage3") { image.Location = new Point(this.Width - 3 * image.Size.Width - 30, 40); } else if (image.Name == "CaptionImage4") { image.Location = new Point(this.Width - 2 * image.Size.Width - 20, 40); } else if (image.Name == "CaptionImage5") { image.Location = new Point(this.Width - image.Size.Width - 10, 40); } image.ImageMouseEnter += new CaptionImage.MouseEnter(image_ImageMouseEnter); image.ImageMouseLeave += new CaptionImage.MouseLeave(image_ImageMouseLeave); image.ImageMouseMove += new CaptionImage.MouseMove(image_ImageMouseMove); image.ImageMouseUp += new CaptionImage.MouseUp(image_ImageMouseUp); this.Resize += new EventHandler(Main_Resize); } this.HideControlboxHighlights(); }
public SliderProperty(string _name, int _initValue, int _min, int _max, DecimalPlaceCount dpc = DecimalPlaceCount.None) { type = Type.SliderProperty; name = _name; value = _initValue; min = _min; max = _max; switch (dpc) { case DecimalPlaceCount.None: divideBy = 1; break; case DecimalPlaceCount.Single: divideBy = 10; break; case DecimalPlaceCount.Double: divideBy = 100; break; } tb = new TrackBarEx(); tb.Style = TrackBarEx.Theme.Office2016Colorful; tb.Location = new System.Drawing.Point(-2, -3); tb.ValueChanged += new EventHandler(UpdateNumBox); //tb.ShowButtons = false; tb.Minimum = min; tb.Maximum = max; tb.Value = value; tb.AutoSize = false; //tb.BackColor = Color.FromArgb(45, 45, 48); tb.SliderSize = new System.Drawing.Size(tb.SliderSize.Width + 5, tb.SliderSize.Height); tb.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; n = new NumericTextBox(); n.Width = 31; n.Height = 11; n.ReadOnly = true; n.Location = new System.Drawing.Point(n.Location.X - 2, -2); n.Text = (_initValue / divideBy).ToString(); n.NumberDecimalDigits = 1; // divider for trackbar and numerictextbox. sc = new SplitContainer(); sc.Orientation = Orientation.Vertical; sc.Panel1.Controls.Add(tb); sc.Panel2.Controls.Add(n); sc.BorderStyle = BorderStyle.FixedSingle; sc.SplitterDistance = sc.Width - 31; sc.FixedPanel = FixedPanel.Panel2; sc.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left; sc.IsSplitterFixed = true; sc.Size = new System.Drawing.Size(sc.Width - 15, 17); tb.Size = new System.Drawing.Size(sc.Panel1.Width, 20); safeToUpdate = true; }