using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms.Design; using DevComponents.Instrumentation; namespace DevComponents.Instrumentation.Design { /// /// KnobControlDesigner /// public class KnobControlDesigner : ControlDesigner { #region Private variables private KnobControl _KnobControl; private DesignerActionListCollection _ActionLists; #endregion #region Initialize /// /// Initializes our designer /// /// public override void Initialize(IComponent component) { base.Initialize(component); if (component.Site.DesignMode == true) _KnobControl = component as KnobControl; } #endregion #region Verbs /// /// Creates our verb collection /// public override DesignerVerbCollection Verbs { get { DesignerVerb[] verbs = new DesignerVerb[] { new DesignerVerb("KnobStyle 1", SetStyle1), new DesignerVerb("KnobStyle 2", SetStyle2), new DesignerVerb("KnobStyle 3", SetStyle3), new DesignerVerb("KnobStyle 4", SetStyle4), }; return (new DesignerVerbCollection(verbs)); } } #endregion #region SetStyle /// /// Sets the control to Style1 /// /// /// protected virtual void SetStyle1(object sender, EventArgs e) { _KnobControl.KnobStyle = eKnobStyle.Style1; } /// /// Sets the control to Style2 /// /// /// protected virtual void SetStyle2(object sender, EventArgs e) { _KnobControl.KnobStyle = eKnobStyle.Style2; } /// /// Sets the control to Style3 /// /// /// protected virtual void SetStyle3(object sender, EventArgs e) { _KnobControl.KnobStyle = eKnobStyle.Style3; } /// /// Sets the control to Style4 /// /// /// protected virtual void SetStyle4(object sender, EventArgs e) { _KnobControl.KnobStyle = eKnobStyle.Style4; } #endregion #region ActionLists /// /// Gets our DesignerActionListCollection list /// public override DesignerActionListCollection ActionLists { get { if (_ActionLists == null) { _ActionLists = new DesignerActionListCollection(); _ActionLists.Add(new KnobControlActionList(_KnobControl)); } return (_ActionLists); } } #endregion } }