Home Dashboard Directory Help

CCheckListBox incorrectly displays BST_INDETERMINATE check state by Matt Lindner


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 641001
Opened: 2/2/2011 11:38:27 AM
Access Restriction: Public
User(s) can reproduce this bug


I am using a CCheckListBox in order to get a list box with check boxes in it. I have set the check style to use BS_AUTO3STATE in order to use the BST_INDETERMINATE check state.

There is a bug in CCheckListBox::PreDrawItemThemed that causes the check box to be drawn incorrectly when this state is active. The checkbox ends up being drawn as if it was unchecked and disabled.

The function uses the following code to convert the check to the draw state.

            int nState = CBS_UNCHECKEDNORMAL;
            switch (nCheck)
            case 1 :
                nState = CBS_CHECKEDNORMAL;
            case 2 :
                nState = CBS_UNCHECKEDDISABLED;

case 2 : is used for BST_INDETERMINATE. However, nState should be set to CBS_MIXEDNORMAL to correctly draw the checkbox.
Sign in to post a comment.
Posted by Matt Lindner on 2/8/2011 at 10:06 AM
Thanks for the update.

When you say "major release," do you mean the upcoming service pack for VS 2010 or the release after that (presumably VS 2012)?

Posted by Microsoft on 2/8/2011 at 9:53 AM
Hello Matt,

Thanks for the report. This issue has been fixed in MFC for the next major release of Visual Studio.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 2/6/2011 at 10:16 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by Matt Lindner on 2/4/2011 at 2:30 PM
I uploaded TriStateCheckListDemo.zip. This project will produce a dialog application containing a CCheckListBox as well as some individual check boxes. The CCheckListBox and the check boxes all has the BS_AUTO3STATE style. Both the CCheckListBox and the check boxes each have an example of each of the three checked states: BST_UNCHECKED, BST_CHECKED and BST_INDETERMINATE. The check box with BST_INDETERMINATE is displayed incorrectly in the CCheckListBox.
Posted by Microsoft on 2/2/2011 at 6:44 PM
Thanks for reporting this issue. Please give us a demo project to demonstrate this issue so that we can conduct further research.

Thanks again for your efforts and we look forward to hearing from you.

Microsoft Visual Studio Connect Support Team

Posted by Microsoft on 2/2/2011 at 11:59 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
TriStateCheckListDemo.zip 2/4/2011 18.64 MB