private void circlePanel_Click(object sender, EventArgs e) { this.lightShapeValue = MarqueeLightShape.Circle; this.Invalidate(false); this.editorService.CloseDropDown(); }
// This method paints a graphical representation of the // selected value of the LightShpae property. public override void PaintValue(PaintValueEventArgs e) { MarqueeLightShape shape = (MarqueeLightShape)e.Value; using (Pen p = Pens.Black) { if (shape == MarqueeLightShape.Square) { e.Graphics.DrawRectangle(p, e.Bounds); } else { e.Graphics.DrawEllipse(p, e.Bounds); } } }
// This constructor takes a MarqueeLightShape value from the // design-time environment, which will be used to display // the initial state. public LightShapeSelectionControl( MarqueeLightShape lightShape, IWindowsFormsEditorService editorService) { // This call is required by the designer. InitializeComponent(); // Cache the light shape value provided by the // design-time environment. this.lightShapeValue = lightShape; // Cache the reference to the editor service. this.editorService = editorService; // Handle the Click event for the two panels. this.squarePanel.Click += new EventHandler(squarePanel_Click); this.circlePanel.Click += new EventHandler(circlePanel_Click); }
// This constructor takes a MarqueeLightShape value from the // design-time environment, which will be used to display // the initial state. public LightShapeSelectionControl( MarqueeLightShape lightShape, IWindowsFormsEditorService editorService) { // This call is required by the designer. InitializeComponent(); InitializeComponentCustom(); // Cache the light shape value provided by the // design-time environment. this.lightShapeValue = lightShape; // Cache the reference to the editor service. this.editorService = editorService; // Handle the Click event for the two panels. this.squarePanel.Click += new EventHandler(squarePanel_Click); this.circlePanel.Click += new EventHandler(circlePanel_Click); }