Class ButtonEdit
The ButtonEdit class provides an easy way to create controls with an edit control (TextBox and System.Windows.Forms.ComboBox) and any number of associated buttons.
Inheritance
Implements
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Tools.Windows.dll
Syntax
public class ButtonEdit : ContainerControl, IThemeProvider, IVisualStyle, IEditControlsEmbed, IButtonEditParent, IPopupParent, IPopupItem, IThemedControl, ISupportInitialize, INonClientPaintingSupport
Remarks
The buttons can be set to be aligned to either side of the edit control.
The buttons are derived from the System.Windows.Forms.Button class and are implemented in the ButtonEditChildButton class. This class provides a customized version of Button that can work with the ButtonEdit class.
The ButtonEdit class implements the IButtonEditParent interface that enables it to act as a listener with the ButtonEditChildButton class. The ButtonEdit class listens for change notifications from the child ButtonEditChildButton controls and adjusts its layout accordingly.
The buttons can be added to the ButtonEdit control through the designer. The buttons will be automatically laid out. The ButtonEdit control uses GridBagLayout to layout the buttons.
The ButtonEdit class can be easily derived from to replace the standard edit control with a specialized TextBox derived class.
The ButtonEdit class supports the Windows Forms styles and can be used as a regular TextBox control.
Examples
// InitializeComponent sample
this.buttonEdit1 = new Syncfusion.Windows.Forms.Tools.ButtonEdit();
this.buttonEditChildButton1 = new Syncfusion.Windows.Forms.Tools.ButtonEditChildButton();
this.buttonEdit1.SuspendLayout();
this.SuspendLayout();
this.buttonEdit1.Buttons.Add(this.buttonEditChildButton1);
this.buttonEdit1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.buttonEditChildButton1});
this.buttonEdit1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonEdit1.Location = new System.Drawing.Point(8, 16);
this.buttonEdit1.Name = "buttonEdit1";
this.buttonEdit1.SelectionLength = 0;
this.buttonEdit1.SelectionStart = 0;
this.buttonEdit1.ShowTextBox = true;
this.buttonEdit1.Size = new System.Drawing.Size(368, 22);
this.buttonEdit1.TabIndex = 0;
this.buttonEdit1.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
//
// buttonEditChildButton1
//
this.buttonEditChildButton1.ButtonAlign = Syncfusion.Windows.Forms.Tools.ButtonAlignment.Right;
this.buttonEditChildButton1.ButtonEditParent = this.buttonEdit1;
this.buttonEditChildButton1.ButtonType = Syncfusion.Windows.Forms.Tools.ButtonTypes.Browse;
this.buttonEditChildButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonEditChildButton1.Location = new System.Drawing.Point(352, 0);
this.buttonEditChildButton1.Name = "buttonEditChildButton1";
this.buttonEditChildButton1.PreferredWidth = 16;
this.buttonEditChildButton1.Size = new System.Drawing.Size(16, 22);
this.buttonEditChildButton1.TabIndex = 1;
this.buttonEditChildButton1.Click += new System.EventHandler(this.buttonEditChildButton1_Click);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(400, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] { this.buttonEdit1});
this.Text = "Syncfusion ButtonEdit Demo";
this.buttonEdit1.ResumeLayout(false);
this.ResumeLayout(false);
' InitializeComponent sample
Me.buttonEdit1 = New Syncfusion.Windows.Forms.Tools.ButtonEdit()
Me.buttonEditChildButton1 = New Syncfusion.Windows.Forms.Tools.ButtonEditChildButton()
Me.buttonEdit1.SuspendLayout()
Me.SuspendLayout()
Me.buttonEdit1.Buttons.Add(Me.buttonEditChildButton1)
Me.buttonEdit1.Controls.AddRange(New System.Windows.Forms.Control() {Me.buttonEditChildButton1})
Me.buttonEdit1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.buttonEdit1.Location = New System.Drawing.Point(8, 16)
Me.buttonEdit1.Name = "buttonEdit1"
Me.buttonEdit1.SelectionLength = 0
Me.buttonEdit1.SelectionStart = 0
Me.buttonEdit1.ShowTextBox = True
Me.buttonEdit1.Size = New System.Drawing.Size(368, 22)
Me.buttonEdit1.TabIndex = 0
Me.buttonEdit1.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
'
' buttonEditChildButton1
'
Me.buttonEditChildButton1.ButtonAlign = Syncfusion.Windows.Forms.Tools.ButtonAlignment.Right
Me.buttonEditChildButton1.ButtonEditParent = Me.buttonEdit1
Me.buttonEditChildButton1.ButtonType = Syncfusion.Windows.Forms.Tools.ButtonTypes.Browse
Me.buttonEditChildButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.buttonEditChildButton1.Location = New System.Drawing.Point(352, 0)
Me.buttonEditChildButton1.Name = "buttonEditChildButton1"
Me.buttonEditChildButton1.PreferredWidth = 16
Me.buttonEditChildButton1.Size = New System.Drawing.Size(16, 22)
Me.buttonEditChildButton1.TabIndex = 1
AddHandler Me.buttonEditChildButton1.Click, New System.EventHandler(AddressOf buttonEditChildButton1_Click)
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(400, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.buttonEdit1})
Me.Text = "Syncfusion ButtonEdit Demo"
Me.buttonEdit1.ResumeLayout(False)
Me.ResumeLayout(False)</code></pre></coderef>
Constructors
ButtonEdit()
Creates an object of type ButtonEdit and initializes it.
Declaration
public ButtonEdit()
Remarks
The ButtonEdit class can be created by dragging and dropping a ButtonEdit control from the control toolbox. The constructor initializes the embedded TextBox. The embedded child controls will have to be explicitly added to the ButtonEdit object (this will be done by the designer if using the control through the Windows Forms designer).
The CreateTextBox() method provides an easy way to change the default embedded TextBox to a specialized TextBox derived class such as the MaskedEditBox or the CurrencyTextBox.
Fields
DropDownButtonWidth
The width of the dropdown button.
Declaration
protected readonly int DropDownButtonWidth
Field Value
Type |
---|
System.Int32 |
hostFormObject
The host form.
Declaration
protected Form hostFormObject
Field Value
Type |
---|
System.Windows.Forms.Form |
Properties
BackColor
Gets or sets the backcolor of the ButtonEdit control.
Declaration
public override Color BackColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
BackgroundImage
Gets or sets the background image
Declaration
public override Image BackgroundImage { get; set; }
Property Value
Type |
---|
System.Drawing.Image |
BackgroundImageLayout
Gets or sets the background image layout
Declaration
public override ImageLayout BackgroundImageLayout { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ImageLayout |
BeforeTouchSize
Gets/Sets Control size before touch enabled
Declaration
public Size BeforeTouchSize { get; set; }
Property Value
Type |
---|
System.Drawing.Size |
Border3DStyle
Gets or sets the 3D border style for the control.
Declaration
public Border3DStyle Border3DStyle { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Border3DStyle |
Remarks
This property is used only when BorderStyle is Fixed3D.
BorderSides
Gets or sets the border sides for which you want the 3D border style applied.
Declaration
public Border3DSide BorderSides { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Border3DSide |
Remarks
This property is used only when BorderStyle is Fixed3D.
Buttons
Gets or sets the collection of Buttons that makes up this ButtonEdit control.
Declaration
public ButtonEdit.ButtonEditChildButtonCollection Buttons { get; }
Property Value
Type |
---|
ButtonEdit.ButtonEditChildButtonCollection |
Remarks
The Buttons property is a collection of type ButtonEdit.ButtonEditChildButtonCollection that includes all the child buttons that are embedded as child controls in the ButtonEdit control.
You can add and remove buttons and edit their properties through the designer.
ButtonStyle
Gets or sets the button style for the control.
Declaration
public ButtonAppearance ButtonStyle { get; set; }
Property Value
Type |
---|
ButtonAppearance |
CanApplyTheme
Gets or sets a value indicating whether a ButtonEdit theme style has been applied to the control.
Declaration
public bool CanApplyTheme { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
CanOverrideStyle
Gets or sets a value indicating whether control elements styles can be overridden by theme style settings.
Declaration
public bool CanOverrideStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value is false. |
Remarks
By default, the control's element styles will not be overridden by theme style settings if the style is set in sample level. If this property is enabled, element style will be overridden by theme style settings event if it is set in sample level. This property should be enabled or disabled before calling the ThemeName property of the control.
CharacterCasing
Specifies whether the ComboBoxBase control modifies the case of characters as they are typed.
Declaration
public virtual CharacterCasing CharacterCasing { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.CharacterCasing | One of the System.Windows.Forms.CharacterCasing enumeration values that specifies whether the ComboBoxBase control modifies the case of characters. The default is CharacterCasing.Normal. |
DefaultSize
Declaration
protected override Size DefaultSize { get; }
Property Value
Type |
---|
System.Drawing.Size |
DropDownButtonHeight
Gets / sets the height of the drop-down button.
Declaration
protected int DropDownButtonHeight { get; set; }
Property Value
Type |
---|
System.Int32 |
EditPortionHeight
Gets / sets the height of the edit portion.
Declaration
protected int EditPortionHeight { get; set; }
Property Value
Type |
---|
System.Int32 |
EnableTouchMode
Gets or Sets the Touchmode
Declaration
public bool EnableTouchMode { get; set; }
Property Value
Type |
---|
System.Boolean |
FlatBorderColor
Gets or sets the color with which the Flat Border should be drawn.
Declaration
public virtual Color FlatBorderColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color | A Color value. Default is SystemColors.ControlDark. |
FlatStyle
Gets or sets the FlatStyle to be applied to the buttons in the ButtonEdit control.
Declaration
public FlatStyle FlatStyle { get; set; }
Property Value
Type |
---|
System.Windows.Forms.FlatStyle |
Remarks
The ButtonEdit control applies the same FlatStyle to all the child controls in the layout.
ForeColor
Gets or Sets the Forecolor based on layout of the text.
Declaration
public override Color ForeColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
IsVisualStyleEnabled
Gets a value indicating whether the visual style based theme is applied to the ButtonEdit. This also indicates whether the theme files are referred from external assemblies or not.
Declaration
public bool IsVisualStyleEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Return true, if the visual style based theme is applied to ButtonEdit. Otherwise returns false. |
MaximumSize
Gets or sets the maximum size of the control.
Declaration
public override Size MaximumSize { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Size | A Size value. Default is (0,0). |
MetroColor
Gets or sets the theme color of the ButtonAdv
Declaration
public Color MetroColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
MinimumSize
Gets or sets the minimum size of the control.
Declaration
public override Size MinimumSize { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Size | A Size value. Default is (0,0). |
NeedLayout
Indicates whether the Layout method needs to be called to layout the combo elements.
Declaration
[Obsolete("Do not use this property. It is obsolete.")]
public bool NeedLayout { get; }
Property Value
Type |
---|
System.Boolean |
Remarks
Internal method. You will not have to call this property explicitly.
ParentContainer
Gets or sets the ParentContainer control that implements IContainerControl.
Declaration
public IContainerControl ParentContainer { get; set; }
Property Value
Type |
---|
System.Windows.Forms.IContainerControl |
Remarks
Set this property to a Form or UserControl if its not the same as the Parent of the control.
PreventHeightChange
Indicates whether the Height property of the control can be changed.
Declaration
protected bool PreventHeightChange { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True to prevent height change; false otherwise. |
Remarks
Note that this property will be frequently set and reset within the control layout. You can use this temporarily to force a particular height on the control.
SelectionLength
Gets or sets the Selection Length of the embedded TextBox control.
Declaration
public int SelectionLength { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
The ButtonEdit control shadows some of the properties of the embedded TextBox control. The SelectionLength property is shadowed enabling access to the ButtonEdit in a manner similar to the TextBox control for accessing the Text content of the control.
SelectionStart
Gets or sets the SelectionStart property of the ButtonEdit control which is same as the System.Windows.Forms.TextBoxBase.SelectionStart property of the embedded System.Windows.Forms.TextBox.
Declaration
public int SelectionStart { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
The ButtonEdit control shadows some of the properties of the embedded TextBox control. The SelectionStart property is shadowed enabling access to the ButtonEdit in a manner similar to the TextBox control for accessing the Text content of the control.
ShowTextBox
Indicates whether the embedded TextBox is visible in the ButtonEdit.
Declaration
public virtual bool ShowTextBox { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
If the TextBox control is kept invisible, it will be ignored during the layout process and the space will be divided among the child Buttons.
State
Gets or sets the state of the ButtonEdit control.
Declaration
public ButtonAdvState State { get; set; }
Property Value
Type |
---|
ButtonAdvState |
Text
The Text property of the ButtonEdit class is the same
as the System.Windows.Forms.TextBox property of the embedded
TextBox control.
Declaration
public override string Text { get; set; }
Property Value
Type |
---|
System.String |
Remarks
The TextBox control's properties can be changed through the property grid in the designer. The TextBox control can be hidden from view by setting the System.Windows.Forms.Control.Visible property to false. The Text property is overriden to keep the text in sync with the embedded TextBox control's Text property.
TextAlign
Gets or sets the alignment of text in this control.
Declaration
public virtual HorizontalAlignment TextAlign { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.HorizontalAlignment | One of the System.Windows.Forms.HorizontalAlignment enumeration values that specifies how text is aligned in the control. The default is HorizontalAlignment.Left. |
Remarks
You can use this property to align the text within a ComboBoxBase to match the layout of text on your form. For example, if your controls are all located on the right side of the form, you can set the TextAlign property to HorizontalAlignment.Right, and the text will be aligned along the right side of the control instead of the default left alignment.
TextBox
Returns the embedded TextBoxExt control.
Declaration
public TextBoxExt TextBox { get; set; }
Property Value
Type |
---|
TextBoxExt |
Remarks
The TextBoxExt control is the core control of the ButtonEdit control. This control takes up the width of the control minus the widths of the individual buttons. This TextBoxExt control can be accessed through this property.
TextBoxBindings
Use this property to bind the TextBox.
Declaration
public ControlBindingsCollection TextBoxBindings { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ControlBindingsCollection |
ThemeName
Gets or sets the theme name of the ButtonEdit control.
Declaration
public string ThemeName { get; set; }
Property Value
Type |
---|
System.String |
ThemeStyle
Declaration
public ButtonEditVisualStyle ThemeStyle { get; set; }
Property Value
Type |
---|
ButtonEditVisualStyle |
UseVisualStyle
Indicates whether to use visual styles.
Declaration
public bool UseVisualStyle { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
ApplyScaleToControl(Single)
applie the scaling for controls
Declaration
public void ApplyScaleToControl(float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaleFactor |
AttachTextBox()
To Attach TextBox with the control
Declaration
public virtual void AttachTextBox()
BeginInit()
Begins the initialization.
Declaration
public void BeginInit()
buttonIndx_MouseHover(Object, EventArgs)
Sets the Buttonstate
Declaration
public void buttonIndx_MouseHover(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Button Control |
System.EventArgs | e | EventArgs |
ChildButtonAlignmentChanged(ButtonEditChildButton, ButtonAlignment)
This is the implementation of the IButtonEditParent interface for listening to changes to the ButtonEditChildButton child buttons.
Declaration
public void ChildButtonAlignmentChanged(ButtonEditChildButton btn, ButtonAlignment newAlign)
Parameters
Type | Name | Description |
---|---|---|
ButtonEditChildButton | btn | The ButtonEditChildButton that has changed its alignment. |
ButtonAlignment | newAlign | The new alignment of the button. |
Remarks
This notification is sent by the ButtonEditChildButton when the ButtonAlign property value is changed. The ButtonEdit control implements this interface and receives the notification to change its layout in accordance with the new alignment of the ButtonEditChildButton. See the ButtonAlignment type for the values that the ButtonAlignment can support.
ChildButtonSizeChanged(ButtonEditChildButton, Size)
This is the implementation of the IButtonEditParent interface for listening to changes to the ButtonEditChildButton child buttons.
Declaration
public void ChildButtonSizeChanged(ButtonEditChildButton btn, Size newSize)
Parameters
Type | Name | Description |
---|---|---|
ButtonEditChildButton | btn | The ButtonEditChildButton that has changed its size. |
System.Drawing.Size | newSize | The new size of the button. |
Remarks
This notification is sent by the ButtonEditChildButton when the PreferredWidth property value is changed. The ButtonEdit control implements this interface and receives the notification to change its layout in accordance with the new size of the ButtonEditChildButton.
ChildControlsRemovedByDesigner(ArrayList)
Indicates that paint message should not be passed when child controls are removed by designer.
Declaration
public void ChildControlsRemovedByDesigner(ArrayList childControls)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ArrayList | childControls |
Contains(Control)
Checks whether the given child is contained within the control.Returns false for ButtonEdit TextBox.
Declaration
public bool Contains(Control ctl)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | ctl |
Returns
Type |
---|
System.Boolean |
CreateTextBox()
Creates a System.Windows.Forms.TextBox object.
Declaration
protected virtual TextBoxExt CreateTextBox()
Returns
Type | Description |
---|---|
TextBoxExt | The TextBoxExt object that is created. |
Remarks
This method can be overriden to create a TextBoxExt derived class to be returned. This will result in the TextBox object in the ButtonEdit control to be replaced with a derived control.
DetachTextBox()
To Detach TextBox with the control
Declaration
public virtual void DetachTextBox()
DetermineHeightsBasedOnFont(Graphics, ref Int32)
Determines the heights of certain portions of this control.
Declaration
protected virtual void DetermineHeightsBasedOnFont(Graphics g, ref int textAreaHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Not used, obsolete. |
System.Int32 | textAreaHeight | A reference variable through which to return the height for the text area. |
Remarks
Make sure to call the base class when you override this method.
This method expects you to return a height for the text area through the reference variable, set the height of this control and the height of the buttons.
Dispose(Boolean)
Cleans up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
DrawBackground(Graphics, Rectangle)
Draws the unthemed background of this control.
Declaration
protected virtual void DrawBackground(Graphics g, Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context. |
System.Drawing.Rectangle | rect | The System.Drawing.Rectangle within which to draw. |
Remarks
Called by DrawBorderAndBackground(Graphics, Rectangle) to draw the background when not in themes mode.
DrawBorder(Graphics, Rectangle)
Draws the unthemed border of this control.
Declaration
protected virtual void DrawBorder(Graphics g, Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context. |
System.Drawing.Rectangle | rect | The System.Drawing.Rectangle within which to draw. |
Remarks
Called by DrawBorderAndBackground(Graphics, Rectangle) to draw the border when not in themes mode.
DrawBorderAndBackground(Graphics, Rectangle)
Draws the border and background of the control.
Declaration
protected virtual void DrawBorderAndBackground(Graphics g, Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context. |
System.Drawing.Rectangle | rect | The System.Drawing.Rectangle within which to draw. |
Remarks
This method is used to draw the border around the text area (when called from
This method uses themes to draw if necessary or calls DrawBackground(Graphics, Rectangle) and DrawBorder(Graphics, Rectangle) to draw the background and border.
DrawBorderAndBackground(PaintEventArgs)
Called from the Paint event handler to draw the edit portion's border and background.
Declaration
protected virtual void DrawBorderAndBackground(PaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.PaintEventArgs | e | The System.Windows.Forms.PaintEventArgs from the Paint event. |
Remarks
This method calls the DrawBorderAndBackground(Graphics, Rectangle) method with the appropriate dimenison to draw the border around the text portion.
EndInit()
Indicates the object that initialization is complete.
Declaration
public void EndInit()
GetActiveEditControl(IEditControlsEmbedListener)
Returns the active edit control. This implements the IEditControlsEmbed interface.
Declaration
public Control GetActiveEditControl(IEditControlsEmbedListener listener)
Parameters
Type | Name | Description |
---|---|---|
IEditControlsEmbedListener | listener |
Returns
Type | Description |
---|---|
System.Windows.Forms.Control | The edit control that has the current focus. |
Remarks
This interface is implemented so that the AutoComplete control can provide auto completion services for the embedded TextBox control.
GetActiveThemeName()
Gets the active theme name of the ButtonEdit control.
Declaration
public string GetActiveThemeName()
Returns
Type | Description |
---|---|
System.String | Returns the active theme name. |
GetImage(String)
Helper function to get an image from within embedded resources.
Declaration
public static Image GetImage(string resourceName)
Parameters
Type | Name | Description |
---|---|---|
System.String | resourceName | The resource name to get from. |
Returns
Type | Description |
---|---|
System.Drawing.Image | An image; null if the image is not available. |
Remarks
The ButtonEditChildButton class can take an image based on the ButtonType property. This helper function loads the images based on the resource name.
GetIsMirrored()
Gets a value indicating whether the control is mirrored.
Declaration
protected bool GetIsMirrored()
Returns
Type |
---|
System.Boolean |
HandleChildButtonBackColorChanged(Object, EventArgs)
Handles the BackColorChanged event of the child buttons.
Declaration
public void HandleChildButtonBackColorChanged(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
HandleChildButtonClicked(Object, EventArgs)
Handles the Button Clicked event of the child buttons.
Declaration
public void HandleChildButtonClicked(object sender, EventArgs valArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The child button. |
System.EventArgs | valArgs | The event data. |
Remarks
This handler raises the ButtonClicked event and passes the ButtonEditChildButton that was clicked as the sender of the event.
HandleChildButtonMouseDown(Object, MouseEventArgs)
Handles the MouseDown event of the child buttons.
Declaration
public void HandleChildButtonMouseDown(object sender, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.Windows.Forms.MouseEventArgs | e |
HandleChildButtonMouseEnter(Object, EventArgs)
Handles MouseEnter event of the child buttons.
Declaration
public void HandleChildButtonMouseEnter(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
HandleChildButtonMouseLeave(Object, EventArgs)
Handles MouseLeave event of the child buttons.
Declaration
public void HandleChildButtonMouseLeave(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
HandleChildButtonMouseUp(Object, MouseEventArgs)
Handles the MouseUp event of the child buttons.
Declaration
protected void HandleChildButtonMouseUp(object sender, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.Windows.Forms.MouseEventArgs | e |
HandleChildButtonTextChanged(Object, EventArgs)
Handles the Button text changed event of the child buttons.
Declaration
public void HandleChildButtonTextChanged(object sender, EventArgs valArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The child button. |
System.EventArgs | valArgs | The event data. |
HandleChildClicked(Object, EventArgs)
Event handler that sets the Parent's ActiveControl when one of the child controls are clicked.
Declaration
protected void HandleChildClicked(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The child TextBox. |
System.EventArgs | e | The event data. |
Remarks
There is a problem with using the ButtonEdit control inside a UserControl that doesn't update the UserControl's Active Control property properly when the user clicks inside the ButtonEdit. This event handler sets the ActiveControl explicitly.
HandleChildLostFocus(Object, EventArgs)
Handles the LostFocus event event of the child buttons.
Declaration
public void HandleChildLostFocus(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
HandleChildMouseEnter(Object, EventArgs)
Handles the MouseEnter event of the child buttons.
Declaration
public void HandleChildMouseEnter(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
HandleChildMouseLeave(Object, EventArgs)
Handles the MouseLeave event of the child buttons.
Declaration
public void HandleChildMouseLeave(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
HideButton(Int32, Boolean)
Indicates whether a child button is visible or hidden within the ButtonEdit layout.
Declaration
public bool HideButton(int btnIndex, bool visible)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | btnIndex | |
System.Boolean | visible |
Returns
Type |
---|
System.Boolean |
Remarks
There might be instances when you need to hide a child button that is part of the Buttons collection. Calling this method with the button index and the right value for the visibility will set the appropriate visibility for the button and also adjust the layout so that the other child buttons and the TextBox are aligned properly.
InitTextBox()
Initializes the System.Windows.Forms.TextBox used in the editable text portion.
Declaration
protected virtual void InitTextBox()
Remarks
This method is called once to initialize the TextBox used to draw the editable portion of the ButtonEdit. Use the TextBox property to get a reference to the TextBox from inside an override of this method.
Make sure to call the base class when you override this method for default initialization.
CreateTextBox()Layout()
Forces the laying out of combobox elements.
Declaration
public virtual void Layout()
Remarks
Advanced method. You do not have to call this directly.
OnBeginInit()
Begins the initialization.
Declaration
protected virtual void OnBeginInit()
OnBorder3DStyleChanged(EventArgs)
Raises the Border3DStyleChanged event.
Declaration
protected virtual void OnBorder3DStyleChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An EventArgs that contains the event data. |
Remarks
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The OnBorder3DStyleChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors: When overriding OnBorder3DStyleChanged in a derived class, be sure to call the base class's OnBorder3DStyleChanged method so that registered delegates receive the event.
OnBorderSidesChanged(EventArgs)
Raises the BorderSidesChanged event.
Declaration
protected virtual void OnBorderSidesChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An EventArgs that contains the event data. |
Remarks
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The OnBorderSidesChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors: When overriding OnBorderSidesChanged in a derived class, be sure to call the base class's OnBorderSidesChanged method so that registered delegates receive the event.
OnButtonClicked(ButtonClickedEventArgs)
Override this to handle the ButtonClicked event in a derived class. Call the base implementation first so that the delegates will be called.
Declaration
protected virtual void OnButtonClicked(ButtonClickedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
ButtonClickedEventArgs | args | The ButtonClickEventArgs event data. |
Remarks
This method raises the ButtonClicked event when any of the Child buttons are clicked.
OnEndInit()
Indicates that the initialization is complete.
Declaration
protected virtual void OnEndInit()
OnEnter(EventArgs)
Declaration
protected override void OnEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnGotFocus(EventArgs)
Declaration
protected override void OnGotFocus(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnLayout(LayoutEventArgs)
Declaration
protected override void OnLayout(LayoutEventArgs levent)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.LayoutEventArgs | levent |
OnLostFocus(EventArgs)
Declaration
protected override void OnLostFocus(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnMaximumSizeChanged(EventArgs)
Raises the MaximumSizeChanged event.
Declaration
protected virtual void OnMaximumSizeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An EventArgs that contains the event data. |
Remarks
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The OnMaximumSizeChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Note to Inheritors: When overriding OnMaximumSizeChanged in a derived class, be sure to call the base class's OnMaximumSizeChanged method so that registered delegates receive the event.
OnMinimumSizeChanged(EventArgs)
Raises the MinimumSizeChanged event.
Declaration
protected virtual void OnMinimumSizeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An EventArgs that contains the event data. |
Remarks
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The OnMinimumSizeChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Note to Inheritors: When overriding OnMinimumSizeChanged in a derived class, be sure to call the base class's OnMinimumSizeChanged method so that registered delegates receive the event.
OnMouseDown(MouseEventArgs)
Raises the OnMouseDown event.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | Event data. |
OnMouseEnter(EventArgs)
Raises the OnMouseEnter event.
Declaration
protected override void OnMouseEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnMouseLeave(EventArgs)
Raises the OnMouseLeave event.
Declaration
protected override void OnMouseLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnMouseWheel(MouseEventArgs)
Declaration
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e |
OnPaint(PaintEventArgs)
Declaration
protected override void OnPaint(PaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.PaintEventArgs | e |
OnRightToLeftChanged(EventArgs)
Declaration
protected override void OnRightToLeftChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnSizeChanged(EventArgs)
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnThemeChanged(EventArgs)
Raises the ThemeChanged event.
Declaration
protected virtual void OnThemeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An EventArgs that contains the event data. |
Remarks
The OnThemeChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors: When overriding OnThemeChanged in a derived class, be sure to call the base class's OnThemeChanged method so that registered delegates receive the event.
OnThemeNameChanged(String)
Updates the Style renderers of ButtonEdit Control based on applied Theme.
Declaration
public virtual void OnThemeNameChanged(string themeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | themeName |
Refresh()
Refreshes ButtonEdit ChildButtons.
Declaration
public override void Refresh()
ResetBackColor()
Resets to the default ButtonEditBackColor.
Declaration
public override void ResetBackColor()
ResetFlatBorderColor()
Resets the color for the flat border to default.
Declaration
public void ResetFlatBorderColor()
ResetSelectionLength()
Resets the SelectionLength property to its default value.
Declaration
public void ResetSelectionLength()
ResetSelectionStart()
Resets the SelectionStart property to its default value.
Declaration
public void ResetSelectionStart()
ResetShowTextBox()
Resets the ShowTextBox property to its default value.
Declaration
public void ResetShowTextBox()
SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)
Declaration
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | |
System.Int32 | y | |
System.Int32 | width | |
System.Int32 | height | |
System.Windows.Forms.BoundsSpecified | specified |
SetNeedLayout(Boolean)
Forces the laying out of combo elements within the next Paint Message handler.
Declaration
[Obsolete("Use Layout method instead.")]
protected virtual void SetNeedLayout(bool needLayout)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | needLayout | True to force; false to prevent layout. |
ShouldSerializeBackColor()
Declaration
protected bool ShouldSerializeBackColor()
Returns
Type |
---|
System.Boolean |
ShouldSerializeFlatBorderColor()
Declaration
protected bool ShouldSerializeFlatBorderColor()
Returns
Type |
---|
System.Boolean |
ShouldSerializeSelectionLength()
Declaration
protected bool ShouldSerializeSelectionLength()
Returns
Type |
---|
System.Boolean |
ShouldSerializeSelectionStart()
Declaration
protected bool ShouldSerializeSelectionStart()
Returns
Type |
---|
System.Boolean |
ShouldSerializeShowTextBox()
Declaration
protected bool ShouldSerializeShowTextBox()
Returns
Type |
---|
System.Boolean |
UpdateTextBoxAndButtonBounds(Int32)
Updates the bounds of the drop-down button bounds.
Declaration
protected virtual void UpdateTextBoxAndButtonBounds(int textAreaHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | textAreaHeight |
Remarks
Sets the bounds based on the DropDownButtonWidth.
WndProc(ref Message)
Declaration
protected override void WndProc(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m |
Events
Border3DStyleChanged
Fired when Border3DStyle property changes.
Declaration
public event EventHandler Border3DStyleChanged
Event Type
Type |
---|
System.EventHandler |
BorderSidesChanged
Fired when BorderSides property changes.
Declaration
public event EventHandler BorderSidesChanged
Event Type
Type |
---|
System.EventHandler |
ButtonClicked
Raised when one of the child ButtonEditChildButton is clicked.
Declaration
public event ButtonClickedEventHandler ButtonClicked
Event Type
Type |
---|
ButtonClickedEventHandler |
Remarks
Handle this event if you want to handle the click event of any of the child button. You can also add any of the events exposed by the child buttons themselves as the System.Windows.Forms.Button class derived buttons that raise the Click event.
MaximumSizeChanged
This event is raised if the MaximumSize property is changed.
Declaration
public event EventHandler MaximumSizeChanged
Event Type
Type |
---|
System.EventHandler |
MinimumSizeChanged
This event is raised if the MinimumSize property is changed.
Declaration
public event EventHandler MinimumSizeChanged
Event Type
Type |
---|
System.EventHandler |
ThemeChanged
Fired when the ThemesEnabled property changes.
Declaration
public event EventHandler ThemeChanged
Event Type
Type |
---|
System.EventHandler |
ThemeNameChanged
Occurs when theme name of the ButtonEdit has changed.
Declaration
public event ThemeChangedEventHandler ThemeNameChanged
Event Type
Type |
---|
ThemeChangedEventHandler |
Explicit Interface Implementations
INonClientPaintingSupport.NonClientPaint(PaintEventArgs, Rectangle, Rectangle)
Declaration
IntPtr INonClientPaintingSupport.NonClientPaint(PaintEventArgs e, Rectangle displayRect, Rectangle windowRectInScreen)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.PaintEventArgs | e | |
System.Drawing.Rectangle | displayRect | |
System.Drawing.Rectangle | windowRectInScreen |
Returns
Type |
---|
System.IntPtr |
IPopupItem.GetPopupParentControl()
Declaration
Control IPopupItem.GetPopupParentControl()
Returns
Type |
---|
System.Windows.Forms.Control |
IPopupItem.IsRelatedControl(Control, Boolean)
Declaration
bool IPopupItem.IsRelatedControl(Control testControl, bool askParent)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | testControl | |
System.Boolean | askParent |
Returns
Type |
---|
System.Boolean |
IPopupParent.ChildClosing(IPopupChild, PopupCloseType)
Declaration
void IPopupParent.ChildClosing(IPopupChild child, PopupCloseType closeType)
Parameters
Type | Name | Description |
---|---|---|
IPopupChild | child | |
PopupCloseType | closeType |
IPopupParent.GetBorderOverlapCue(PopupRelativeAlignment)
Declaration
Point[] IPopupParent.GetBorderOverlapCue(PopupRelativeAlignment alignment)
Parameters
Type | Name | Description |
---|---|---|
PopupRelativeAlignment | alignment |
Returns
Type |
---|
System.Drawing.Point[] |
IPopupParent.GetLocationForPopupAlignment(PopupRelativeAlignment, out PopupRelativeAlignment)
Declaration
Point IPopupParent.GetLocationForPopupAlignment(PopupRelativeAlignment alignment, out PopupRelativeAlignment newAlignment)
Parameters
Type | Name | Description |
---|---|---|
PopupRelativeAlignment | alignment | |
PopupRelativeAlignment | newAlignment |
Returns
Type |
---|
System.Drawing.Point |
IPopupParent.IsRightToLeft
Declaration
bool IPopupParent.IsRightToLeft { get; }
Returns
Type |
---|
System.Boolean |
IThemedControl.ThemesEnabled
Declaration
bool IThemedControl.ThemesEnabled { get; set; }
Returns
Type |
---|
System.Boolean |
IVisualStyle.VisualTheme
Gets or sets the VisualTheme of the ButtonEdit control.
Declaration
string IVisualStyle.VisualTheme { get; set; }
Returns
Type |
---|
System.String |
IThemeProvider.BaseThemeName
Gets or sets the BaseTheme name of the theme
Declaration
string IThemeProvider.BaseThemeName { get; set; }
Returns
Type |
---|
System.String |
IThemeProvider.ControlName
Gets the name of the control.
Declaration
string IThemeProvider.ControlName { get; }
Returns
Type |
---|
System.String |