Skip to content

Change the check state of the WinForms CheckEdit by clicking exactly on the checkbox.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/winforms-checkedit-change-state-by-clicking-checkbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms CheckEdit - Change the state by clicking exactly on the checkbox (glyph)

The WinForms CheckEdit changes the check state when a user clicks a checkbox or text. This example handles the MouseDown event to prevent the state from changing when the user clicks anywhere other than the checkbox:

private void checkEdit1_MouseDown(object sender, MouseEventArgs e) {
    CheckEdit cEdit = (CheckEdit)sender;
    CheckEditViewInfo cInfo = (CheckEditViewInfo)cEdit.GetViewInfo();
    Rectangle r = cInfo.CheckInfo.GlyphRect;
    Rectangle editorRect = new Rectangle(new Point(0, 0), cEdit.Size);
    if (!r.Contains(e.Location) && editorRect.Contains(e.Location))
        ((DXMouseEventArgs)e).Handled = true;
}

Files to Review

Does this example address your development requirements/objectives?

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