It is sometimes useful to allow the control to receive focus but to make so that it does not render the focus rectangle (the dotted line within the borders of the button). The ShowFocusRect property may be set to false to prevent the control from rendering the focus rectangle when the control receives focus. When set to true, its default value, the focus rectangle will be rendered when the control has the input focus.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.Misc Private Sub InitializeButton(ByVal button As Infragistics.Win.Misc.UltraButton) ' don't display a focus rect when the control gets focus button.ShowFocusRect = False ' allow the control to get focus button.AcceptsFocus = True ' do not show the outline around the control ' when it is the default button button.ShowOutline = False ' specify the images for the control button.ImageList = Me.imageList1 button.Appearance.Image = 2 ' default image button.HotTrackAppearance.Image = 1 ' image when hot tracked button.PressedAppearance.Image = 0 ' image when pressed ' enable hot tracking button.HotTracking = True ' auto size to the image and text button.AutoSize = True ' when the form is displayed using ShowDialog, ' this value will be returned from the method when ' the button is clicked. button.DialogResult = DialogResult.OK ' specify the button style button.ButtonStyle = UIElementButtonStyle.WindowsXPCommandButton ' be sure to turn off themes so the button style will be ' and appearance colors will be applied button.SupportThemes = False End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.Misc; private void InitializeButton(Infragistics.Win.Misc.UltraButton button) { // don't display a focus rect when the control gets focus button.ShowFocusRect = false; // allow the control to get focus button.AcceptsFocus = true; // do not show the outline around the control // when it is the default button button.ShowOutline = false; // specify the images for the control button.ImageList = this.imageList1; button.Appearance.Image = 2; // default image button.HotTrackAppearance.Image = 1; // image when hot tracked button.PressedAppearance.Image = 0; // image when pressed // enable hot tracking button.HotTracking = true; // auto size to the image and text button.AutoSize = true; // when the form is displayed using ShowDialog, // this value will be returned from the method when // the button is clicked. button.DialogResult = DialogResult.OK; // specify the button style button.ButtonStyle = UIElementButtonStyle.WindowsXPCommandButton; // be sure to turn off themes so the button style will be // and appearance colors will be applied button.SupportThemes = false; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2