mfc按钮名称怎么换行_mfc控件使用方法

本文中所用控件变量类型为Control

一般控件可用/不可用

EnableWindow(TRUE);

EnableWindow(FALSE);

1、Static Text------------静态控件--类CStatic

取值/赋值(变量类型为Control)

m_lbl.GetWindowText(string);

m_lbl.SetWindowText(string);

2、Edit Box---------------编辑控件--类CEdit

取值/赋值

m_txt.GetWindowText(string);

m_txt.SetWindowText(string);

3、Check Box------------复选控件--类CButton

(1)设置选中/未选中

m_chk.SetCheck(BST_CHECKED);

m_chk.SetCheck(BST_UNCHECKED);

(2)判断是否选中

int nCur = m_chk.GetCheck();

nCur取值为BST_CHECKED/BST_UNCHECKED。

4、Radio Box------------单选控件--类CButton

(1)默认选中第一项

m_radio.SetCheck(BST_CHECKED);

(2)选中组中任一项

CWnd::CheckRadioButton

Selects (adds a check mark to)a given radio button in a group and clears (removes a check mark from)all other radio buttons in the group.

void CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton );

Parameters

nIDFirstButton

Specifies the integer identifier of the first radio button in the group.

nIDLastButton

Specifies the integer identifier of the last radio button in the group.

nIDCheckButton

Specifies the integer identifier of the radio button to be checked.

(3)判断哪一项被选中

CWnd::GetCheckedRadioButton

Retrieves the ID of the currently checked radio button in the specified group.

int GetCheckedRadioButton(int nIDFirstButton, int nIDLastButton );

Parameters

nIDFirstButton

Specifies the integer identifier of the first radio button in the group.

nIDLastButton

Specifies the integer identifier of the last radio button in the group.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值