在运行时在VC ++ 6.0 MFC中创建控件 [英] Create Controls in VC++ 6.0 MFC at runtime
本文介绍了在运行时在VC ++ 6.0 MFC中创建控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在运行时在VC ++ 6.0 MFC中创建控件(编辑,静态,组合框,日期选择器,单选按钮),并动态创建消息映射.
在VB6中,我可以通过创建控件数组来做到这一点.
知道代码的人吗?
提前解冻. :)
I want to Create Controls(edit, static, combobox, datepicker, radiobutton) in VC++ 6.0 MFC at runtime and dynamically create message maps.
In VB6 i can do it by creating a control array.
Anyone who knows the code?
thaks in advance. :)
推荐答案
您可以在此处查看代码段
1. http://www.winprog.org/tutorial/app_one.html [ http://social.msdn.microsoft. com/forums/zh-CN/vcgeneral/thread/d61192b6-5d51-47ea-bad2-bae8594eb0fa [
You can check here for code snippets
1. http://www.winprog.org/tutorial/app_one.html[^]
2. http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/d61192b6-5d51-47ea-bad2-bae8594eb0fa[^]
您可以通过调用相应的Create来完成类的函数.例如,yu可以通过调用CEdit :: Create函数来创建Edit框.
如果您需要添加事件,请对其进行子类化,并使用消息映射添加所需的处理程序.很简单.
希望这会有所帮助
http://cgmath.blogspot.com
You can do it by calling appropriate Create functions of classes.. For example yu can create Edit box by calling C:Create function.
if you need to add events , sub class it and add the desired handlers using message maps. It is pretty easy.
Hopes this helps
http://cgmath.blogspot.com
我在codeproject上有一篇应用文章:
BasicAdmin2-个人理财软件 [
I have an app article here on codeproject:
BasicAdmin2 - Personal Finance Software[^]
In the file BasicAdmin2_Utils/GenDialog/DialogHelper.cpp you''ll find:
CreateLabel
CreateGroupBox
CreateComboBox
CreateTextBox
CreateShortCutBox
CreateNumeric
CreateDate
CreateDateTime
CreateMultiEdit
CreateCheckBox
All of them use Create and CreateEx.
这篇关于在运行时在VC ++ 6.0 MFC中创建控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文