protected virtual void SetEditorProps(FlashTrackBar editingInstance, FlashTrackBar editor) { editor.ShowValue = true; editor.StartColor = Color.Navy; editor.EndColor = Color.White; editor.ForeColor = Color.White; editor.Min = editingInstance.Min; editor.Max = editingInstance.Max; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.flashTrackBar1 = new Microsoft.Samples.WinForms.Cs.FlashTrackBar.FlashTrackBar(); this.Text = "Control Example"; this.ClientSize = new System.Drawing.Size(600, 450); flashTrackBar1.BackColor = System.Drawing.Color.Black; flashTrackBar1.Dock = System.Windows.Forms.DockStyle.Fill; flashTrackBar1.TabIndex = 0; flashTrackBar1.ForeColor = System.Drawing.Color.White; flashTrackBar1.Text = "Drag the Mouse and say Wow!"; flashTrackBar1.Value = 73; flashTrackBar1.Size = new System.Drawing.Size(600, 450); this.Controls.Add(this.flashTrackBar1); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { FlashTrackBar trackBar = new FlashTrackBar(); trackBar.ValueChanged += new EventHandler(this.ValueChanged); SetEditorProps((FlashTrackBar)context.Instance, trackBar); bool asInt = true; if (value is int) { trackBar.Value = (int)value; } else if (value is byte) { asInt = false; trackBar.Value = (byte)value; } edSvc.DropDownControl(trackBar); if (asInt) { value = trackBar.Value; } else { value = (byte)trackBar.Value; } } } return(value); }
protected override void SetEditorProps(FlashTrackBar editingInstance, FlashTrackBar editor) { base.SetEditorProps(editingInstance, editor); editor.Min = 0; editor.Max = byte.MaxValue; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { FlashTrackBar trackBar = new FlashTrackBar(); trackBar.ValueChanged += new EventHandler(this.ValueChanged); SetEditorProps((FlashTrackBar)context.Instance, trackBar); bool asInt = true; if (value is int) { trackBar.Value = (int)value; } else if (value is byte) { asInt = false; trackBar.Value = (byte)value; } edSvc.DropDownControl(trackBar); if (asInt) { value = trackBar.Value; } else { value = (byte)trackBar.Value; } } } return value; }