[英]How to get numeric updown control?
I have searched in toolbox and many post but don't know where to find this type of control to use on MFC:我在工具箱和许多帖子中进行了搜索,但不知道在哪里可以找到在 MFC 上使用的此类控件:
Does such a control exist in MFC? MFC中是否存在这样的控件?
The control is known as a "Spin Control" in the Visual Studio Resource editor and they are normally associated with a "Buddy" edit control.该控件在 Visual Studio 资源编辑器中称为“旋转控件”,它们通常与“好友”编辑控件相关联。 You can set this in the "Behaviour" group of its "Properties" window – with "Auto Buddy" set to "True", it will associate with the 'nearest' edit control (actually, the previous control in the Z-order).
您可以在其“属性”window 的“行为”组中设置它——将“自动好友”设置为“真”,它将与“最近”编辑控件相关联(实际上是 Z 顺序中的前一个控件) . You will probably also want to have "Set Buddy Integer" set to "True".
您可能还希望将“Set Buddy Integer”设置为“True”。
There are numerous routines associated with such controls (such as those to set/get the range and position), and the behaviour is encapsulated in the CSpinButtonCtrl
class, for which there is a good overview here .有许多与此类控件相关的例程(例如设置/获取范围和位置的例程),并且行为封装在
CSpinButtonCtrl
class 中,这里有一个很好的概述。
If you prefer to manually edit/create your resource scripts, then you'll need a control of the msctls_updown32
class, which should be added immediately following the buddy edit window, as in the following code excerpt:如果您更喜欢手动编辑/创建资源脚本,那么您需要控制
msctls_updown32
class,它应该在伙伴编辑 window 之后立即添加,如以下代码摘录所示:
IDP_OPTMD DIALOGEX 0, 0, 262, 180
STYLE WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTION
CAPTION L"Dilation/Skeletonisation"
FONT 10, P_GUIFONT
{
GROUPBOX L"Pixel Dilation Options", IDC_DILPG, 10, 6, 247, 99, BS_GROUPBOX | SS_NOTIFY
AUTOCHECKBOX L"Enable advanced options dialogue box?", IDC_DILEO, 17, 17, 160, 11, BS_AUTOCHECKBOX
LTEXT L"Cycles =", IDC_DCYCS|0x8000, 190, 18, 30, 11, SS_NOTIFY
EDITTEXT IDC_DCYCS, 221, 17, 28, 12, ES_CENTER | ES_NUMBER, WS_EX_CLIENTEDGE
CONTROL 1, IDC_DCYUD, L"msctls_updown32", UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |UDS_ARROWKEYS
| UDS_NOTHOUSANDS, 241, 17, 12, 10
//...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.