标题为复选框的分组框 [英] Group box with title as Check box

查看:104
本文介绍了标题为复选框的分组框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows XP平台中使用Visual Studio 6.0(带有MFC的VC ++).我正在尝试创建一个组框,其中该组框的标题为复选框.我的意图是:如果启用了复选框,则应该启用组框中的控件;否则,请启用该复选框.否则将被禁用.

I am using Visual Studio 6.0 (VC++ with MFC) in Windows XP platform. I am trying to create a group box with the title of the group box as a check box. My intention is this: If the check box is enabled, the controls inside the group box should be enabled; or else disabled.

这有可能实现吗?如果是,请给我一些指导.

Is this possible to accomplish? If yes, please give me some directions.

谢谢.

推荐答案

您可以尝试一些方法,具体取决于您对想法的坚持程度以及准备投入多少工作:

There are a few things you can try, depending on how true you want to stay to your idea and how much work you are prepared to put into the effort:

使用普通的分组框,然后在此框内将第一项作为复选框.这很容易实现,但是您失去了以复选框作为标题的目标.

Use a normal group box, and then inside this make the first item be the checkbox. This is simple to accomplish, but you lose the goal of having the checkbox as the title.

使用普通的分组框,然后在您知道标题将要去的位置的空白处,放置您的复选框.您将不得不执行一些棘手的计算,以使其很好地适应并且绘制流畅而不会闪烁.

Use a normal group box, then in the space over where you know the title is to go, place your checkbox. You will have to perform some tricky calculation to get it to fit in nicely and draw well without flicker.

使用某种形式的超类子类/

Use some form of superclass or subclass/subclass on the group box. You can override the WM_PAINT handler to draw in only the frame for the group box. Place a normal checkbox in the place where you know the title is to go. This should work better because you will have more control over the drawing, but it is likely to be tricky to get right. In my experience, subclassing is lower risk to implement than superclassing.

这篇关于标题为复选框的分组框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆