Visual-c – How to make the MFC check box for just-only but keep the text enabled?

It seems that disabling the checkbox via the Disabled attribute will also make the title gray. Does anyone know how to keep the title enabled but disable input?

Edit

Based on Paul’s ideas, I have completed the following operations (now I find that static labels and checkboxes have transparent properties).

>Add several checkboxes.
>Set the checkbox title to empty.
>Set the checkbox transparency property to true.
>Add several labels next to the checkbox .
>Change the transparent property of the label to true.
>Expand the checkbox to include the label (so clicking on the label will trigger the checkbox).

However, this gave me Very strange result. When I expand the checkbox on the label, it covers the label even though both are transparent. Again, I am new to MFC (I am a C# guy) so maybe I am missing something .

The quick and simple solution is not to use the checkbox “text member (set it To “”), reduce the size of the check box to a clickable square, just place a label next to the check box.

In order to get a little fancier, you can create A custom control to host a check box and a label that can be reused. It is also an easier way to make a custom check box behave as expected by the end user, such as being able to set the check box to be selected when the label is clicked Or uncheck, and the checkbox itself. (The simple solution does not automatically associate the label and the checkbox. You can code it in the form, but if you tend to reuse the paradigm, it may quickly become Ugly.)

You can also look around for third-party checkbox controls (there are many MFC UI libraries out there), but this may be a bit too much.

See this pseudo-layout:< /p>

You have this: (isolated checkbox control)

[x "checkbox text"]

Place it like this: (The label control is aligned next to the check box)

[x][label: "label text"]

Handle the click event of the label, for example:

void OnLabelClick(...) {
if (checkBox.Enabled)
checkBox.Checked = !checkBox.Checked;
}

It seems that disabling the checkbox via the Disabled attribute will also make the title gray. Does anyone know How to keep the title enabled but disable input?

Edit

Based on Paul’s ideas, I have completed the following operations (now I find that static labels and checkboxes have transparent properties).

>Add several checkboxes.
>Set the checkbox title to empty.
>Set the checkbox transparency property to true.
>Add several labels next to the checkbox .
>Change the transparent property of the label to true.
>Expand the checkbox to include the label (so clicking on the label will trigger the checkbox).

However, this gave me Very strange result. When I expand the checkbox on the label, it covers the label even though both are transparent. Again, I am new to MFC (I am a C# guy) so maybe I am missing something .

The quick and simple solution is not to use the check box “Text member (set it to “”), and reduce the size of the check box To the clickable box, just place a label next to the check box.

In order to get a little fancier, you can create a custom control to host a check box and a Labels that can be reused. It is also an easier way to make custom checkboxes behave as expected by the end user, such as being able to set the checkbox to be checked or unchecked when the label is clicked, and the checkbox itself. (Simple The solution does not automatically associate tags and checkboxes. You can code them in the form, but if you tend to reuse examples, it may quickly become ugly.)

You too You can look around for third-party checkbox controls (there are many MFC UI libraries out there), but this may be a bit too much.

See this pseudo-layout:

You have this: (isolated Checkbox control)

[x "checkbox text"]

Place it like this: (the label control is aligned next to the checkbox)

p>

[x][label: "label text"]

Handle label click events, for example:

< pre>void OnLabelClick(…) {
if (checkBox.Enabled)
checkBox.Checked = !checkBox.Checked;
}

< /p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2196 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.