急急急!!!怎么取得Radio Button的状态?

fly2skylee 2001-12-04 10:09:55
我现在有ID大约例如IDC_RADIO_PROXY这样的一组Radio Button,我现在想取得它是否被选择,还想利用程序来让它选中某个Radio Button,有谁知道的,急用多谢!
...全文
232 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
fly2skylee 2001-12-04
  • 打赏
  • 举报
回复
万分感谢,散分!
xt_jat 2001-12-04
  • 打赏
  • 举报
回复
CButton* pButton=(CButton*)GetDlgItem(IDC_RADIO1);
pButton->SetCheck(1);
fly2skylee 2001-12-04
  • 打赏
  • 举报
回复
我只能利用GetDlgItem(IDC_RADIO_PROXY)取到一个CWnd,不是CButton.
fly2skylee 2001-12-04
  • 打赏
  • 举报
回复
可是我怎么取得这个CButton的指针呢?
wormholes 2001-12-04
  • 打赏
  • 举报
回复
int GetCheck( ) const;
Value Meaning
0 Button state is unchecked.
1 Button state is checked.
2 Button state is indeterminate (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
If the button has any other style, the return value is 0.
joke100 2001-12-04
  • 打赏
  • 举报
回复

CButton::GetState
UINT GetState( ) const;

Return Value

Specifies the current state of the button control. You can use the following masks against the return value to extract information about the state:

Mask Meaning
0x0003 Specifies the check state (radio buttons and check boxes only). A 0 indicates the button is unchecked. A 1 indicates the button is checked. A radio button is checked when it contains a bullet (). A check box is checked when it contains an X. A 2 indicates the check state is indeterminate (three-state check boxes only). The state of a three-state check box is indeterminate when it contains a halftone pattern.
0x0004 Specifies the highlight state. A nonzero value indicates that the button is highlighted. A button is highlighted when the user clicks and holds the left mouse button. The highlighting is removed when the user releases the mouse button.
0x0008 Specifies the focus state. A nonzero value indicates that the button has the focus.



CButton::SetCheck
void SetCheck( int nCheck );

Parameters

nCheck

Specifies the check state. This parameter can be one of the following:

Value Meaning
0 Set the button state to unchecked.
1 Set the button state to checked.
2 Set the button state to indeterminate. This value can be used only if the button has the BS_3STATE or BS_AUTO3STATE style.

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧