Skip to content

DevExpress-Examples/winforms-radiogroup-custom-draw-items

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Radio Group - Custom draw radio items

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).

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)