Back to Devexpress

BaseButton.PaintStyle Property

windowsforms-devexpress-dot-xtraeditors-dot-basebutton.md

latest2.8 KB
Original Source

BaseButton.PaintStyle Property

Gets or sets the button’s paint style.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(PaintStyles.Default)]
[DXCategory("Appearance")]
public PaintStyles PaintStyle { get; set; }
vb
<DefaultValue(PaintStyles.Default)>
<DXCategory("Appearance")>
Public Property PaintStyle As PaintStyles

Property Value

TypeDefaultDescription
DevExpress.XtraEditors.Controls.PaintStylesDefault

The button’s paint style.

|

Remarks

Use the PaintStyle property to switch between the Default and Light render modes.

  • Default - A button renders its background in all states (normal, hovered, pressed and focused).

  • Light - A button renders its background only when hovered, pressed or selected. This mode is specifically designed so you can create a group of borderless buttons.

Example

The following example arranges SimpleButtons in a StackPanel and enables the Light button paint style.

Note

The svgImageCollection1 was created and populated at design time.

csharp
for (int i = 0; i < 4; i++) {
    SimpleButton btn = new SimpleButton();
    btn.Size = new Size(42, 42);
    btn.PaintStyle = DevExpress.XtraEditors.Controls.PaintStyles.Light;
    btn.Text = "";
    btn.ImageOptions.Location = ImageLocation.MiddleCenter;
    btn.ImageOptions.SvgImage = svgImageCollection1[$"chart{i}"];
    stackPanel1.Controls.Add(btn);
}
vb
For i As Integer = 0 To 3
    Dim btn As New SimpleButton()
    btn.Size = New Size(42, 42)
    btn.PaintStyle = DevExpress.XtraEditors.Controls.PaintStyles.Light
    btn.Text = ""
    btn.ImageOptions.Location = ImageLocation.MiddleCenter
    btn.ImageOptions.SvgImage = svgImageCollection1($"chart{i}")
    stackPanel1.Controls.Add(btn)
Next i

To prevent a SimpleButton from being focused, use the SimpleButton.AllowFocus property.

See Also

BaseButton Class

BaseButton Members

DevExpress.XtraEditors Namespace