RadButton is a replacement of the standard WinForms Button. RadButton supports themes.
- To add a RadButton to your form, drag a RadButton from the toolbox onto the surface of the form designer.
- To programmatically add a RadButton to a form, create a new instance of a RadButton, and add it to the form Controls collection.
Copy[C#] Adding a RadButton at runtime
RadButton myNewRadButton = new RadButton();
myNewRadButton.Text = "My New RadButton";
myNewRadButton.Width = 150;
myNewRadButton.Height = 50;
this.Controls.Add(myNewRadButton);
Copy[VB.NET] Adding a RadButton at runtime
Dim myNewRadButton As New RadButton()
myNewRadButton.Text = "My New RadButton"
myNewRadButton.Width = 150
myNewRadButton.Height = 50
Me.Controls.Add(myNewRadButton)
Antialiased text
Use the following code snippet to set the TextRenderingHint property of the TextPrimitive to use antialiasing:
Copy[C#]
((TextPrimitive)myNewRadButton.ButtonElement.Children[1].Children[1]).TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
Copy[VB.NET]
DirectCast(myNewRadButton.ButtonElement.Children(1).Children(1), TextPrimitive).TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
You can alternatively create a theme using the Visual Style Builder which sets the property for the TextPrimitive node.