This example creates a custom radio group control that allows you to manually paint radio items:
void OnCustomDrawItem(object sender, CustomDrawEventArgs e) {
if (e.ItemInfo.CheckState == CheckState.Checked) {
e.ItemInfo.Appearance.Font = new Font(e.ItemInfo.Appearance.Font, FontStyle.Bold | FontStyle.Underline);
}
if (e.ItemInfo.State == DevExpress.Utils.Drawing.ObjectState.Hot) {
LinearGradientBrush brush = new LinearGradientBrush(e.ItemInfo.Bounds, Color.LightBlue, Color.Cyan, LinearGradientMode.ForwardDiagonal);
e.Cache.FillRectangle(brush, e.ItemInfo.Bounds);
e.CheckPainter.DrawObject(e.ItemInfo);
e.Handled = true;
}
}
Note
You can also use the following pre-designed and ready-to-use group controls shipped as part of DevExpress WinForms UI Templates:
DevExpress WinForms UI Templates include predesigned and ready-to-use UI components and forms (C# and Visual Studio 2022 only).
- CustomDrawEventArgs.cs (VB: CustomDrawEventArgs.vb)
- CustomRadioGroup.cs (VB: CustomRadioGroup.vb)
- CustomRadioGroupPainter.cs (VB: CustomRadioGroupPainter.vb)
- Main.cs (VB: Main.vb)
- Program.cs (VB: Program.vb)
- RepositoryItemCustomRadioGroup.cs (VB: RepositoryItemCustomRadioGroup.vb)
(you will be redirected to DevExpress.com to submit your response)