091112(星期四)To use a common control in a dialog box

本文详细介绍了如何在Windows对话框中使用通用控件,包括放置控件、声明成员变量、初始化控件状态以及处理控件输入等关键步骤。此外,还提供了通过对话框数据交换进行控件值设置和获取的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 最近忙啊,时间不够用,只能稍微看看,慢慢来了

 

The Windows common controls can be used in dialog boxes, form views, record views, and any other window based on a dialog template. The following procedure, with minor changes, will work for forms as well.

 

Place the control on the dialog template using the dialog editor.

Add to the dialog class a member variable that represents the control. In the Add Member Variable dialog box, check Control variable and ensure that Control is selected for the Category.

If this common control is providing input to the program, declare additional member variable(s) in the dialog class to handle those input values.

Note   You can add these member variables using the context menu in Class View (see Adding a Member Variable).

In OnInitDialog for your dialog class, set the initial conditions for the common control. Using the member variable created in the previous step, use the member functions to set initial value and other settings. See the following descriptions of the controls for details on settings.

You can also use dialog data exchange (DDX) to initialize controls in a dialog box.

 

In handlers for controls on the dialog box, use the member variable to manipulate the control. See the following descriptions of the controls for details on methods.

Note   The member variable will exist only as long as the dialog box itself exists. You will not be able to query the control for input values after the dialog box has been closed. To work with input values from a common control, override OnOK in your dialog class. In your override, query the control for input values and store those values in member variables of the dialog class.

You can also use dialog data exchange to set or retrieve values from the controls in a dialog box.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值