几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » ObjectARX(C++)
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-16, 10:34 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】objectarx&dummies习题(二)—— using a mfc dialog

objectarx&dummies习题(二)—— using a mfc dialog
objectarx&dummies习题(二)—— using a mfc dialog
lab 2 - using a mfc dialog
hello,
our second lab will cover mfc contents and some interaction with autocad. the main idea is to keep this lab simple to consolidate mfc and user interaction knowledge.
requirements:
* class 1 to 10;
* autocad 4/5/6 or compatible vertical installed;
* visual studio .net 2 installed;
* objectarx wizard installed.
objectives:
create a simple objectarx module with 1 commands: dlgcolor. this command will create a simple mfc dialog with a color combo box and one selection button. as the user clicks on this button it will prompt user to select one or more existing entities. after click apply it will change the color of all selected entity.
instructions:
- create a project called arxlab2 using objectarx wizard;
- enable using mfc option with autocad mfc extensions;
- click on the a> icon at arxwizard's toolbar to open command dialog;
- right click on the above portion and select new;
- change the global an local name for dlgcolor and select modal as command mode;
- open the visual studio editor and add a new dialog layout. add a combo box control and a button control;
- open the autodesk class explorer, right click on the root and select add mfc ext. class. select cacuidialog as the base class;
- in the dialog layout, right click on the combo box and select add variable. choose cacuitruecolorcombobox as its class and name it as m_color. right click on the combo again and select properties. set has strings = true, owner draw = fixed;
- now, right click the button and select add variable. choose cacuiselectbutton as its class and name it as m_select. right click once more, select properties. set owner draw = true.
- add the virtual bool oninitdialog() method. inside its implementation add the following:
cacuidialog:ninitdialog();
setwindowtext("objectarx for dummies - lab 2");
m_select.autoload();
return true;
- map a click event to selection button. right click on it, select add event handler. select bn_clicked event. inside the event function, we will need to hide the dialog and switch to autocad screen. as we have derived from cacuidialog it already has a couple of functions to do that. so we will need to hide the dialog, select the desired entities and then show the dialog back. your function outline will be something like this:
begineditorcommand();
// perform here the user interaction (allow user to select entities)
completeeditorcommand();
- don't forget to switch the resources to your application before open the dialog:
cacmoduleresourceoverride res;
cdlgcolor dlg;
dlg.domodal();
tips:
- don't forget to call close() for all selected entities (use a transaction if you prefer);
- explore the code to understand what arx wizard has created for you;
- pay attention to code syntax;
- use the objectarx documentation when necessary;
support:
if you have any questions please post your issue on this article to share with others.
expected time:
- i will give you 3 days to accomplish this lab;
- after this period, i will post my suggested solution for this.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】dll学习(资料收集) huangyhg vc编程 0 2008-05-17 09:24 PM
深入探讨mfc消息泵 huangyhg vc编程 2 2007-10-29 04:14 PM


所有的时间均为北京时间。 现在的时间是 09:05 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多