gpt4 book ai didi

c++ - 为什么我的编辑控件 "add variable"弹出框没有 CString 作为选项

转载 作者:行者123 更新时间:2023-11-30 03:14:39 24 4
gpt4 key购买 nike

我对 MFC 和对话框还很陌生。我正在尝试遵循一个非常简单的 YouTube tutorial : 《VC++/C++ MFC教程1:创建用户输入对话框》

视频和许多其他来源似乎将 CString 作为编辑控件的变量类型,但我只有原始类型(见附图)。

目前正在运行 VS2017

我试图通过创建一个新项目来重新配置一些项目设置。但是,此时我只是在盲目转动旋钮。

image

我的版本上的可用类型。

image

显示我希望拥有的类型 (CString)。

最佳答案

  • 当您右键单击实际类 本身以添加变量时,它只会显示变量类型的通用列表。但是,如您所见,您并不局限于下拉列表中的值。您还可以键入一个值,例如 CString。这在 VS 2019 中是相同的:

Add Variable

Add Variable

  • 当您右键单击对话框上的控件时,IDE 知道它通常会映射到什么类型的变量。因此,如果您右键单击一个 EDIT 控件,并选择将其映射到一个而不是一个控件,它默认为CString

Add Variable

Add Variable


这是 documented在 Microsoft 网站上:

  • If you're adding a member variable that isn't a dialog box control, select from the list of available types. For information about the types, see Fundamental Types.

  • If you're adding a member variable for a dialog box control, this box is filled with the type of object that is returned for a control or value. If you select Control, then Variable type specifies the base class of the control you select in the Control ID box. If the dialog box control can hold a value, and if you select Value, then Variable type specifies the appropriate type for the value that control can hold. For more information, see dialog box controls and variable types.

关于c++ - 为什么我的编辑控件 "add variable"弹出框没有 CString 作为选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57650455/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com