各位高手,小弟在VC中使用CobArray遇到些问题,烦请解答,在线等&……

guanzi1983guanzi 2010-09-14 10:07:23
添加数据到Cobarray中
CObArray m_obArray;
CGraph *pGraph=new CGraph(m_nDrawType,m_ptOrigin,point);
m_obArray.Add(pGraph);
删除动态分配的内存和CObArray
delete m_obArray.GetAt(i);//释放内存
m_obArray.RemoveAll();//删除CObArray数据
我的问题
1。释放时候,释放的是动态分配的内存地址,还是CGraph(m_nDrawType,m_ptOrigin,point);类中添加的数据
2.m_obArray.RemoveAll();删除的是CGraph类中的数据,还是存储CGraph内存的地址
3。CGraph *pGraph=(CGraph*)new CGraph(m_nDrawType,m_ptOrigin,point);
将动态开辟的地址的指针值传递到*pGraph中,程序也没有问题,不知道是怎么回事。
谢谢高手们,在线等
...全文
165 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
guanzi1983guanzi 2010-09-14
  • 打赏
  • 举报
回复
dengzikun
离开了吗。
最后一个问题,我就结贴了
dengzikun 2010-09-14
  • 打赏
  • 举报
回复
是的.

你可以简单地认为m_obarray开辟了连续的内存,做数组,每个数组单元存放一个CGraph指针,通过这个指针
,可以访问到你创建的CGraph对象.
guanzi1983guanzi 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 dengzikun 的回复:]
m_obArray为保存CGraph对象的指针开辟了内存.RemoveAll释放的是m_obArray开辟的内存.
[/Quote]

我是不是可以这样理解
m_obarray保存我开辟对象的内存,比如0x888888;
RemoveAll释放的是m_obarray保存对象内存的地址。

那我还想问一下,m_obarray中通过我开辟对象,是怎么访问我对象中的数值呢
就是说我存在m_obarray中的对象内存,我是怎么对象值得,我知道可以通过索引getat来访问,就是不明白,怎么连接的。谢谢


暮雨晨舟 2010-09-14
  • 打赏
  • 举报
回复
好像和孙鑫的VC视频中有一节很像的
dengzikun 2010-09-14
  • 打赏
  • 举报
回复
m_obArray为保存CGraph对象的指针开辟了内存.RemoveAll释放的是m_obArray开辟的内存.
guanzi1983guanzi 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 dengzikun 的回复:]
MSDN的解释:

Removes all the pointers from this array but does not actually delete the CObject objects.
[/Quote]
这个我看了,他说的是删除m_obArray.Add(pGraph);
pGraph的指针值,就这里我不明白,CObArray里面存的是我初始化类的数据,还是我动态开辟的内存地址啊,烦请详细说明,谢了
guanzi1983guanzi 2010-09-14
  • 打赏
  • 举报
回复
dengzikun---问一下

那最后的m_obArray.RemoveAll();//释放的是什么数据呢,是保存CGraph类的地址??
dengzikun 2010-09-14
  • 打赏
  • 举报
回复
MSDN的解释:

Removes all the pointers from this array but does not actually delete the CObject objects.

guanzi1983guanzi 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 guanzi1983guanzi 的回复:]
delete m_obArray.GetAt(i);//释放内存
m_obArray.RemoveAll();//删除CObArray数据
--------------------------------------
这里不是有注释说的很清楚吗?


这是我自己写的哈
我想问的是delete m_obArray.GetAt(i);//释放内存
释放的是CGraph类,开辟的地址内存……
[/Quote]


那最后的m_obArray.RemoveAll();//释放的是什么数据呢,是保存CGraph类的地址??
dengzikun 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 guanzi1983guanzi 的回复:]
引用楼主 guanzi1983guanzi 的回复:
添加数据到Cobarray中
CObArray m_obArray;
CGraph *pGraph=new CGraph(m_nDrawType,m_ptOrigin,point);
m_obArray.Add(pGraph);
删除动态分配的内存和CObArray
delete m_obArray.GetAt(i);//释放内存
……
[/Quote]

不用强制变换,new不但分配内存,还调用CGraph的构造函数做初始化.
所以new后就不单单是一块内存了,是一个对象了。
guanzi1983guanzi 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用楼主 guanzi1983guanzi 的回复:]
添加数据到Cobarray中
CObArray m_obArray;
CGraph *pGraph=new CGraph(m_nDrawType,m_ptOrigin,point);
m_obArray.Add(pGraph);
删除动态分配的内存和CObArray
delete m_obArray.GetAt(i);//释放内存
m_obArray.RemoveAll();//删除C……
[/Quote]



第三个问题是
CGraph *pGraph=(CGraph*)new CGraph(m_nDrawType,m_ptOrigin,point);
与CGraph *pGraph=new CGraph(m_nDrawType,m_ptOrigin,point);
多了一个强制把内存地址变为指针啊
dengzikun 2010-09-14
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 guanzi1983guanzi 的回复:]
delete m_obArray.GetAt(i);//释放内存
m_obArray.RemoveAll();//删除CObArray数据
--------------------------------------
这里不是有注释说的很清楚吗?


这是我自己写的哈
我想问的是delete m_obArray.GetAt(i);//释放内存
释放的是CGraph类,开辟的地址内存……
[/Quote]

释放的是CGraph类对象开辟的地址内存,释放后,CGraph类对象内的值就无效了.
guanzi1983guanzi 2010-09-14
  • 打赏
  • 举报
回复
delete m_obArray.GetAt(i);//释放内存
m_obArray.RemoveAll();//删除CObArray数据
--------------------------------------
这里不是有注释说的很清楚吗?


这是我自己写的哈
我想问的是delete m_obArray.GetAt(i);//释放内存
释放的是CGraph类,开辟的地址内存,还是我CGraph类中的值
Eleven 2010-09-14
  • 打赏
  • 举报
回复
delete m_obArray.GetAt(i);//释放内存
m_obArray.RemoveAll();//删除CObArray数据
--------------------------------------
这里不是有注释说的很清楚吗?
dengzikun 2010-09-14
  • 打赏
  • 举报
回复
1.释放的是pGraph指向的对象.
2.把指针从数组中删掉,但不删除指针所指的对象.
3.不明白说的什么意思.
第一课: Windows程序运行原理及程序编写流程,窗口产生过程,句柄原理,消息队列,回调函数,窗口关闭与应用程序退出的工作关系,使用VC++的若干小技巧,stdcall与cdecl调用规范的比较,初学者常犯错误及注意事项。我们通常不必要知晓每一个函数和消息。但另一方面,也不得不记住其的一部分,否则很难将VC++运用自如。到底该记住哪些,这在我们的课程都会涉及到。 第二课: C++经典语法与应用,类的编写与应用,构造与析构函数,函数的重载,类的继承,函数覆盖,基类与派生类的构造函数、析构函数先后调用顺序,如何在派生类构造函数向基类的构造函数传递参数,this成员变量,类型转换的内幕,虚拟函数与奇妙多态性。VC工程的编译原理与过程,将工程不同的类拆分到不同的原文件,每一个类由一个.h和.cpp文件共同完成,然后解决头文件重复定义问题,培养了学员良好的编程习惯,也为以后分析MFC Appwizard生成的工程奠定了良好基础。 第三课: 讲述MFC AppWizard的原理与MFC程序框架的剖析。AppWizard是一个原代码生成工具,是计算机辅助程序设计软件,Winmain在MFC程序是如何从源程序被隐藏的,theApp全局变量是如何被分配的,MFC框架的几个类的作用与相互关系,MFC框架窗口是如何产生和销毁的,对窗口类的PreCreateWidow和OnCreate两个函数的着重分析,Windows窗口与C++的CWnd类的关系。 第四课: 讲述如何运用ClassWizard及对MFC消息响应函数机制的分析,理解发送给窗口的消息是如何被MFC框架通过窗口句柄映射表和消息映射表来用窗口类的函数进行响应的。掌握设备描述表及其封装类CDC的使用,CDC是如何与具体的设备发生关联的,融合具体的画图程序进行分析。如何设置封闭图形的填充刷子(位图画刷与透明画刷的使用)。 第五课: 掌握CDC的文字处理程序的编写,如何产生自定义字体和自定义插入符,熟悉对CString类的使用。通过对kala ok程序的编写,讲解定时器的使用和DrawText函数的巧妙运用。讲解如何使用CDC的裁减功能。 第六课: 菜单的工作原理及编写应用,菜单命令消息在MFC框架程序的几个类的传递顺序和处理过程。标记菜单的实现原理、图形菜单的实现及常犯错误的分析,GetSystemMetrics的应用,快捷弹出菜单的实现方式及其命令响应函数有效范围(与弹出菜单时所指定的父窗口有密切的关系,最底层的子窗口具有最优先的处理机会)。 第七课.: 动态菜单的编写,如何让程序在运行时产生新的菜单项及如何手工为这些新产生的菜单命令安排处理函数,如何在顶层窗口截获对菜单命令的处理,更进一步掌握CString类的应用。 第八课.: 对话框用户界面程序的编写,如何向对话框控件联接数据成员及其实现机理,如何向对话框控关联控件类,如何利用对话框类的成员函数向控件发送消息和获取对话框控件的类指针,如何直接利用对话框控件类操纵对话框控件(发送消息和直接调用成员函数)。如何在程序运行时产生和销毁控件。对话框控件的几种操作方式的优劣比较分析。 第九课: 如何让对话框上的文本框在程序启动后立即获得焦点,如何利用SetWindowLong改变窗口的回调函数,通过改变文本框的默认回车处理方式进行演示。实现多个输入文本框间通过回车逐一向下传递焦点的另一种巧妙方法(用缺省按钮来处理)。利用SetWindowLong和定时器轮回改变窗口的图标。如何实现对话框的部分收缩和展开。如何在主对话框程序启动时立即隐藏对话框的巧妙实现方式与精妙思想(不能直接在OnInitDialog处理。包括自定义消息的实现) 第十课: 如何制作属性页对话框和向导对话框,融合讲解组合框(如何调整组合框的大小)、列表框、单选按钮、复选按钮 等常用对话框控件的多种使用方法。如何限制用户在不满足设定的条件时切换到其他属性页和向导页。 第十一课: 如何修改MFC AppWizard向导生成的框架程序的外观,包括修改标题栏的多种方式及原理,修改图标、光标、背景的两种方法。如何给应用程序增加工具栏和删除工具栏按钮。定制状态栏,在CView获取状态栏对象的几种方式,在状态栏添加时钟显示(掌握CTime类和静态成员变量和函数的用法),鼠标坐标显示,进度条(主窗口产生后立即产生进度条的巧妙思想,不能在OnCreate函数直接处理,要用到自定义消息的方法)。如何为窗口添加背景位图。 第十二课: 如何使用自定义画笔(颜色,线宽,线形),画刷(形状,颜色)。如何为程序添加选项菜单和选项设置对话框,如何使用标准颜色对话框,窗口重绘原理,在选项对话框实现预览功能。实现选项对话框和窗口类的数据交换。 第十三课: 如何让CDC上输出的文字、图形具有保持功能,元文件设备描述表的使用,CpaintDC与CClientDC的区别与应用,OnPaint与Ondraw在CView的关系及实现内幕,集合类CObArray使用,滚动窗口的实现,设备坐标与逻辑坐标的转换。 第十四课: 文件读写,CFileDialog,CFile,fstream,CArchive类的使用与比较。在应用讲解const char *与char * const的区别,字符串的使用原理,如何使用CString的内存缓冲区。注册表与win.ini文件的读写方式及相关知识点。 第十五课: 如何利用CDocument类的串行化存储功能及MFC框架程序提供的文件打开与保存功能的实现原理。如何实现类对串行化的支持,CObArray的串行化实现内幕。MFC框架程序的几个主要类之间如何获得相互的指针引用。 第十六课: 网络程序的编写,Socket是连接应用程序与网络驱动程序的桥梁,Socket在应用程序创建,通过bind与驱动程序建立关系。此后,应用程序送给Socket的数据,由Socket交给驱动程序向网络上发送出去。计算机从网络上收到与该Socket绑定的IP+Port相关的数据后,由驱动程序交给Socket,应用程序便可从该Socket提取接收到的数据。网络应用程序就是这样通过socket进行数据的发送与接收的。UDP与TCP的工作原理与编写过程,包含如何在程序连接库文件,telnet工具软件在编写网络程序的用途 第十七课: 多线程程序的编写,如何通过互斥来保证多线程的安全。如何利用命名互斥保证只有一份程序实例被运行,结合多线程,网络编程,自定义消息,数据类型转换,如何改变文本框对回车的默认处理方式等技术编写网络聊天程序。 第十八课: 动态连接库程序的编写,库函数的两种输出方式。调用程序对动态连接库的静态连接与动态连接方式,如何利用工具查看动态连接库里的函数,C/C++连接规范的命名转变问题分析,如何获得动态连接库里的函数 的指针,如何用typedef声明指向函数的指针类型。如何调试动态连接库。 第十九课: ActiveX控件的应用与工作原理,ActiveX控件的编写,如何为控件安排属性,方法,事件,属性页,持久性存储。如何注册控件与取消控件注册。如何测试与调试控件。 第二十课: 综合答疑与一些高深主题的介绍,包括如何安装系统钩子函数,dll连接库里的全局变量数据共享问题分析,ADO数据库编程,如何将数据库记录显示在Clistview网格。 以上内容为作者对课件的初步整理,还有很多课堂上要讲到,但在本大纲还没有被撰稿的内容,以后将逐渐完善本大大纲。
Using CVtxButton Implementing the CVtxButton class is surprisingly easy: Include Vtx.h, Vtx.ccp, VtxButton.h, and VtxButton.cpp in your project. Drop a button on your dialog in Developer Studio. Add #include "VtxButton.h" immediately before #include "MyDlg.h" in MyDlg.cpp and MyApp.cpp. For each button on the dialog that you want to be a CVtxButton, add CVtxButton m_cButton1; immediately after //{{AFX_DATA(CMyDlg) in the public section of your dialog class' specification. Also add DDX_Control(pDX, IDC_BUTTON1, m_cButton1); immediately after //{{AFX_DATA_MAP(CMyDlg) in DoDataExchange() for each button. This is enough to create a default CVtxButton. The button is drawn as a rectangle that takes up the entire client area. The sides will not be shaded the same as CButton because they are colored according to the difference of their angle and the angle of light source. If you use at least one CVtxButton on a dialog, it is suggested that you change all your CButton's to CVtxButton's to maintain a coordinated look. If you want to change the look of the CVtxBuUtton, there are two ways of doing so: Use a predefined shape by adding m_cButton1.SetVtx(VTX_RECT); to OnInitDialog() in MyDlg.cpp. There are four predefined shapes which can be passed as an argument to SetVtx(): VTX_RECT VTX_DIAMOND VTX_CIRCLE VTX_STRETCHEDCIRCLE Create a CVtxPolygons object and pass it as an argument to SetVtx(): CRect rect; m_cButton1.GetClientRect(&rect); // Get the button's original dimensions CVtxPolygons vtxPolygons; int offset[4] = {0, 1, 2, 4}; for (int i = 0; i < 4; i++) // Iterate through each of the polygons { // Add the corners vtxPolygons.Add(i, CVertex(rect.left + offset[i], rect.top + offset[i])); vtxPolygons.Add(i, CVertex(rect.right - offset[i] - 1, rect.top + offset[i])); vtxPolygons.Add(i, CVertex(rect.right - offset[i] - 1, rect.bottom - offset[i] - 1)); vtxPolygons.Add(i, CVertex(rect.left + offset[i], rect.bottom - offset[i]
1,01.zipMFC Extension LibraryMFC扩展界面库, 使用Visual C++ 6.0(15KB)2,02.zipVisual Studio style UIVisual Studio风格的界面效果(15KB)3,03.zipInternet Explorer 4 style UIIE4.0风格的界面效果(29KB)4,04.zipOutlook Style UIOutlook风格的界面效果(16KB)5,05.zipDynamic child window repositioning动态改变对话框的大小, 对话框的控件相应改变(15KB)6,06.zipEnhanced list control增强的List控件(43KB)7,07.zipCDialog using animated control在CDialog使用动画(12KB)8,08.zipOpen Dialog with Bitmap Preview位图预览的打开文件对话框(43KB)9,09.zipStandard file open dialog with preview标准位图预览的打开文件对话框(24KB)10,10.zipBitmap Dialog Class位图对话框类(13KB)11,11.zipClass for Browsing shell namespace with your own dialog显示目录的树型结构, 可用于目录的选择(31KB)12,12.zipUsing ON_UPDATE_COMMAND_UI with dialogs在对话框使用ON_UPDATE_COMMAND_UI(13KB)13,13.zipUsing ON_UPDATE_COMMAND_UI with dialogs (2)使用ON_UPDATE_COMMAND_UI(11KB)14,14.zipModeless child dialog in a Main Dialog with corrected tab order非模式对话框在主对话框的TAB顺序(21KB)15,15.zipCostumizing CFileDialog定制的CFileDialog(22KB)16,16.zipAttaching Elements to Borders一个可以在对话框改变按纽位置、大小的容器(26KB)17,17.zipScrolling credits dialog滚动信用对话框(12KB)18,18.zipColor Dialog with Persistent Custom Colors对话框继承了上一次的颜色风格(12KB)19,19.zipA Base Dialog Class for Modal/Modeless Dialog with Custom Background Color自定义背景的对话框(13KB)20,20.zipParse IP addresses解析IP地址(12KB)21,21.zipParse phone fields解析电话区域(11KB)22,22.zipChanging the default file open/save dialogs in an MFC doc/view application初始化对话框和支持动态数据交换(DDX)(15KB)23,23.zipDialog with Splash Screen Example Code...Splash对话框的例子(18KB)24,24.zipClass to select directory选择目录的类(13KB)25,25.zipClass to select directory (Enhancements)增强的选择目录的类(12KB)26,26.zipDirectory Picker Dialog目录采集对话框(42KB)27,27.zipSimple way to change dialog's background and text colors改变对话框背景颜色和文字颜色的简单途径(11KB)28,28.zipA Simple Dialog Layout Manager一个简单的对话框设计管理器(19KB)29,29.zipUsing Buttons on a Dialog Bar with CCmdUI通过CCmdUI在对话框条使用按纽(19KB)30,30.zipDisplay help for dialog controls on the status bar在状态条显示对话框控件的帮助信息(12KB)31,31.zipDragging a dialog by clicking anywhere on it点击任何地方拖动对话框(11KB)32,32.zipSplash screen with text on it that uses its own thread通过自己的线程在Splash对话框显示文字(136KB)33,33.zipCreating an expanding dialog创建一个可扩展的对话框(15KB)34,34.zipExpanding/Contracting Dialog Box扩展/缩小对话框(24KB)35,35.zipCFileDialog class that only displays folders让CFileDialog只显示目录(很有用)(2KB)36,36.zipFolder Browsing Dialog目录浏览对话框(3KB)37,37.zipFont dialog with custom text preview & color字体对话框增加字体和颜色的预览(12KB)38,38.zipEmbedding an HTML Help window into a dialog嵌入一个超文本(HTML)的帮助窗口到对话框(22KB)39,39.zipDialog which can be used as MDI child window使用MDI子窗口的对话框(13KB)40,40.zipConvert modal dialogs to modeless将模式对话框转换成非模式对话框(12KB)41,41.zipNetscape 4.x Preferences Dialog类似Netscape 4.x参数选择的对话框(7KB)42,42.zipHandling OnUpdate() processing for menu itemsOnUpdate()处理菜单项(5KB)43,43.zipOptions Tree Dialog树状的配置对话框(25KB)44,44.zipCustomizing the font dialog定制的字体对话框(4KB)45,45.zipSizable dialogs at its easiest轻松改变对话框的大小(5KB)46,46.zipA Snap Size Dialog Class一个捕获对话框大小的类(5KB)47,47.zipCSplitterWnd in a Dialog based Application一个基于对话框的应用(6KB)48,48.zipSplash Screen with 256 color support支持256色的Splash对话框(7KB)49,49.zipSubselection Dialog 子项选择的对话框(5KB)50,50.zipSwitching dialog boxes in a dialog-based application在基于对话框应用切换对话框(5KB)51,51.zipBetter Tip of the Day dialog典型的Did you konw...对话框(26KB)52,52.zipToolbars and Statusbars on Dialogs在对话框增加工具条和状态条(7KB)53,53.zipTooltips in modal dialog boxes在模式对话框实现工具提示(6KB)54,54.zipTooltips for dialog controls实现对话框控件的工具提示(4KB)55,55.zipTransparent Dialog透明的对话框(5KB)56,56.zipViewing Dialog Template Resources at Runtime运行时看对话框模板资源(5KB)57,57.zipAlternative Wizard Dialog一个Wizard对话框, 在安装程序也有用(5KB)58,58.zipAVLTree实现AVL(Addison-Velski and Landis)树结构(5KB)59,59.zipTemplate class to manipulate bits of undefined type一个操作未知类型的模板库(5KB)60,60.zipBlowfish EncryptionBlowfish加密算法加密(4KB)61,61.zipBlowfish encryption classBlowfish加密类(5KB)62,62.zipExpression Evaluation数学公式识别类(5KB)63,63.zipA Y2.038K-Safe Replacement for CTimeCTime的替换类(5KB)64,64.zipIterating through List Containers关于List容器的话题(5KB)65,65.zipLexical Analyser词汇分析(8KB)66,66.zipLocales and Facets in Visual C++VC++的许多细节话题(10KB)67,67.zipA Generalized Parsing Class for MFC一个普通的MFC解析类(5KB)68,69.zipCreating Singleton Objects using Visual C++使用VC++创建一个单独的对象(9KB)69,69.zipSmart Pointers and other Pointer classes指针类(5KB)70,70.zipSortable CObArray class对CObArray类排序(5KB)71,71.zipSortable CObList class对CObList类排序(6KB)72,72.zipExtension to the STL find_if and for_each扩充STL库(5KB)73,73.zipChange from child window to popup window (and back) 将一个子窗口改成弹出式窗口(5KB)74,74.zipRestoring Window Position With Multiple Monitors在多层监视器恢复窗口的位置(5KB)75,75.zipTransparent Window透明的窗口(6KB)76,CenterMDIWnd_demo.zipCenter CMDIChildWnds in the client area of the main frame window(151KB)77,TabbedMDI.zipA variation on the MDI that indicates the open child windows in a tab control. (400KB)78,AdvancedPrev.zipA simple class that helps provide faster Print Preview within MFC Doc/View applications(38KB)79,mditab.zipA dockable bar containing a tabbed list of open windows(91KB)80,CloseUnusedDocs_src.zipClosing unused MDI documents with 1 line of code(2KB)81,graphfx_demo.zipA Doc/View framework for displaying graphical data(192KB)82,WindowsManager.zipImplementing "Windows..." dialog(39KB)83,MultiMRUList_src.zipThis article describes how to maintain the separate MRU list for each document type that is needed in some applications(26KB)84,MultiTop.zipAllows an application to have multiple top-level windows. (22KB)85,PersistFrames.zipA collection of classes that allows MFC SDI and MDI applications to remember the positions and sizes of their main frame and child frame windows. (71KB)86,step0.zipA series of articles that resulted from experimenting with adding Drag and Drop features to my existing application. (16KB)87,undo.zipEasily add Undo/Redo to your CDocument/CView Based Applciation(2KB)88,PropertyView.zipA "Property Sheet"-like view class for MFC (108KB)89,DocViewWTL.zipA library that provides the easiest way to get loosely coupled components. (156KB)90,Dialog2.zipA step by step tutorial showing how to create your first windows program using MFC(112KB)91,MyMDIApp.zipA brief step-by-step tutorial that demonstrates creating an SDI and MDI based applications using the MFC Doc/View architecture.(54KB)92,sditutorial_demo.zipA brief step-by-step tutorial that demonstrates creating an SDI based application that does not use the MFC Doc/View architecture.(15KB)93,QuickWin.zipRedirect stdin, stdout and stderr into a window(125KB)94,GradientTitleBar.zipThis article shows you how to give your Win95/NT4 modeless dialogs a Win98/W2K like gradient title bar.(42KB)95,MsgBoxDemo.zipThe system Message Box that is closed atuomatically after some time(21KB)96,step1.zipSimple step by step article explaining how to create a modeless dialog box as child window.(21KB)97,step2.zipSimple step by step article explaining how to create a modeless dialog box as sibling of the app's main window.(22KB)98,ResizableDialog.zipA CDialog derived class to implement resizable dialogs with MFC (98KB)99,CenterAnywhere_demo.zipThis is a good replacement for CWnd::CenterWindow() that works. (43KB)100,CardDialog.zipA auto-sizing dialog used to store and display smaller child dialogs(22KB)101,scrolling_credits.zipA Scrolling Credits Dialog(209KB)102,snapdialog.zipDialog class that implement a snap-to-screen-border feature like Winamp(16KB)103,messagebox.zipA class which encapsulates MessageBoxIndirect.(18KB)104,rfldlg.zipThis article demonstrates how to add a recent file list to a dialog based application(25KB)105,dialogspl_demo.zipSplash screens are not only for Doc/View based applications(142KB)106,CClockCtrl_src.zipA Freeware MFC class to display an analog clock.(17KB)107,ChildDlg.zipChild Dialog (Sub Forms)(29KB)108,CIconDialog_src.zipA Freeware MFC dialog class to select an icon.(12KB)109,CPushPinFrame_src.zipA Freeware MFC PushPin property page dialog class.(19KB)110,showhide.zipA neat way to show/hide groups of related controls(13KB)111,ResizeCtrl.zipA resize control to implement resizable dialogs with MFC(38KB)112,DDXFile_src.zipA Freeware DDX routine for selecting a filename.(29KB)113,DynWindow_src.zipDescribes a method to implement resizable child windows.(108KB)114,DynamicDialog.zipCreate dialogs dynamically, and easily, without the need for a dialog resource script.(40KB)115,DlgExpand.zipThis article shows gives you the ability to make your dialogs expand or contract, depending on how much information the user wishes to view(15KB)116,TipDemo.zipImproved Tip-of-the-Day Dialog(149KB)117,layoutmgr.zipA framework to provide automatic layout control for dialogs and forms(101KB)118,MainWndPlacement.zipSave/restore the main window size at application exit/startup with a single function call in MDI, SDI and dialog based applications.(29KB)119,sizer_demo.zipAn article on extendable layout management classes(27KB)120,Splasher_src.zipAn improved splash screen component for MFC.(62KB)121,StackDialog.zipCreating a stacked dialog such as Netscape's 'Preferences' dialog(22KB)122,bitmappreviewdialog_src.zipThis article describes a completely object oriented standard file open dialog with preview.(12KB)123,subselect_dialog.zipSubselection Dialog(123KB)124,TabDialog.zipA docking dialog that auto-expands when the mouse passes over it(35KB)125,TcxMsgBox.zipTCX Message Box (derived from CWnd)(35KB)126,ToolTips.zipA demonstration of how to show tooltips in modal dialog bozes(23KB)127,UpdateModalDlg_demo.zipHow to update a modal dialog contents using a callback function(17KB)128,WinampWnd_demo.zipAn article discussing a Plugin for Nullsoft Winamp which looks and behaves like the Winamp UI.(43KB)129,Skins.zipA mini library to build Bitmap based skinnable apps.(174KB)130,FaderWnd_demo.zipAn MFC class to fade any window with only one line of code.(28KB)131,Win2kFileDlg.zipEver wanted to use the new Office 2000 file dialogs on Win 95/98/NT/Me, including the file previewing? Well now you can.(76KB)132,win2000fd.zipHow to show the new Common File Dialog in MFC Apps in Windows 2000(36KB)133,Wizard2000.zipCreate Windows 2000 style Wizards with white backgrounds(109KB)134,FileExportDialog.zipAdding filters to the Open File dialog(24KB)135,customize_dialog.zipCustomizing the Windows Common File Open Dialog(15KB)136,SelectFolder.zipThe windows 'Select Folder' dialog with some extra functionality(41KB)137,animate_dlg.zipAnimated Icon on Titlebar of a Dialog based Application(34KB)138,BmpDlg.zipBitmap Dialog Class(52KB)139,namespace.zipClass for Browsing shell namespace with your own dialog(78KB)140,OnUpdate_demo.zipHandling OnUpdate() processing for menu items(10KB)141,DialogUpdates.zipUsing ON_UPDATE_COMMAND_UI with all controls in a Dialog(18KB)142,override.zipCustomizing the font dialog(4KB)143,cmdlg.zipCostumizing CFileDialog(31KB)144,custom_open.zipCustom Open File or Save as Dialog(25KB)145,ColorFormView.zipCFormView Class with Custom Background Color(33KB)146,Banner.zipAnimated Background Banner(88KB)147,MDIClient.zipA Custom MDI Client Class(42KB)148,html_help_view.zipHTML Help In CView Window(5KB)149,MDIPreview_demo.zipPrint Preview in MDI Frame(20KB)150,zoom_scale.zipAdd Zoom and Scale Capabilities to CScrollView(338KB)151,autopan.zipAuto-Panning Windows(44KB)152,autopan2.zipMicrosoft Internet Explorer like Intellimouse AutoScroll(42KB)153,intellipan.zipIntellimouse panning (improved Auto-Panning Windows)(5KB)154,intellipan2.zipIntellimouse panning 2 (A universal Auto-Panning solution)(12KB)155,bigscroll.zipBreaking the CScrollView 32768 size limitation with CBigScrollView(90KB)156,variable_splitter.zipVariable splitter views(58KB)157,TabbedViews_src.zipTabbed Views(78KB)158,animate_icon_src.zipAnimated Icon on Titlebar of a window(48KB)159,msdi1632.zipMultiSingle (MSDI) Document interface(77KB)160,msdidao.zipMultiSingle (MSDI) Document interface with DAO doc(508KB)161,ScreenSwitch_demo.zipMultiple Views Using SDI(26KB)162,multiview.zipMultiple views for a single document (MDI) 3(86KB)163,WinMenu_demo.zipHome made MDI windows list in Window menu(21KB)164,SdiMulti.zipSDI Interface with Multi-Views and Multi-Splitters(88KB)165,DocViewInDll_demo.zipSeparating the views of an MDI application into different DLLs(60KB)166,MultiFrame_demo.zipMultiple frame windows in SDI application(76KB)167,mrcext.zipResizable Docking Window(862KB)168,sizing.zipSizing TabControlBar(46KB)169,devstudio.zipAnother DevStudio-alike DialogBar(43KB)170,docking.zipResizable Docking Window 2(98KB)171,simple_splitter.zipGeneral Purpose Splitter Class(43KB)172,cxysplitter.zipA pair of splitter classes used in dialogbox(21KB)173,dynamic_splitter.zipSplitter Window - "True" dynamic splitter window(52KB)174,outlook_style.zipOutook Style Splitter Bar(59KB)175,minsplit.zipMinimum size splitter(36KB)176,scrbsplt.zipRemoving and reapplying splitter windows on-the-fly in Scribble with a custom splitter window class(157KB)177,switchviews_in_splitter.zipSwitching views in splitter panes (SDI)(44KB)178,rulers_src.zipImplementing Rulers inside of Splitter Panes(5KB)179,dynamic1.zipDifferent Views In Dynamic Splitter(202KB)180,dialogstartupanimation.zipThis sample shows you how to create dialog startup animation like that of Window 98'menu(18KB)181,yqeditgridcontrol.zipa grid control that enable keyboard input. That is to say, you can write data in it. (31KB)182,switchmdiviews.zipThis sample shows you how to switch from one view to the other in a MDI splitter window application(31KB) 183,yqmdireplaceview.zipThis sample shows you how to replace different views in a MDI splitter window application(36KB) 184,switchview.zipThis sample shows you how to switch from one MDI window to another by using the "Ctrl Tab" key.(29KB) 185,filterreturnkey.zipThis sample shows you how to trap, filter the ENTER and ESCAPE key of a dialog box (17KB)186,filterkey.zipThis sample shows you how to filter a certain key and mask that key(18KB)187,editenter.zipThis sample shows you how to use RETURN key to switch among edit controls of a dialog box(18KB)188,dialoghook.zipThis sample shows you how to set keyboard hook function of a dialog box to trap RETURN ,ESCAPE key.(17KB) 189,contexthelp.zipThis sample shows you how to create context sensitive help of a control of a dialog box(26KB) 190,traparrokey.zipThis sample describes how to trap arrow keys in an control of a dialog box (18KB)191,yqadvancedbtn.zipOwner draw hot button support both bitmap and icon, with flat, gripper property. (108KB)192,drawlistbo.zipOwner draw CTabCtrl with flat gripper property (40KB)193,startupanimation.zipCreate Window startup animation, including several kind of animation style, very interesting(23KB) 194,flatlistbox.zipusing a unique way to implement flat attribute( other than those published on the codegurn), as well as hot ,gripper attribute.(21KB) 195,yqhoteditctrl.zipCreate edit control with Hot , flat, gripper. separator attributes (21KB)196,3dmdishadow.zipCreate 3D shadow of a MDI frame windows(32KB) 197,3dsdishadow.zipCreate 3D shadow of a SDI frame windows(29KB)198,getfile.zipA DDX routine for MFC to retrieve filenames(29KB)199,splasher.zipAn improved splash screen component for MFC(62KB)200,pushpin.zipA pushpin button MFC class(12KB)201,getfolder.zipA DDX routine for MFC to retrieve folders(30KB)202,ntray.zipAn MFC class to manipulate tray icons(17KB)203,hlinkctrl.zipAn MFC class to support hyperlinks on windows and dialogs(16KB)204,icondialog.zipAn icon selection dialog class for MFC(12KB)205,pushpinframe.zipAn MFC class to provide property dialogs ala Developer Studio(16KB)206,mappin.zipAn MFC class to implement map pins(286KB)207,iconcombobox.zip2 MFC classes to implement icon selection combo boxes(19KB)208,menuex_demo.zipImplementing an Ownerdrawn menu (35KB)209,bcmenu261.zipCool Owner Drawn Menus with BitmapsVersion 2.61(70KB)210,dynmenu.zipSome handy functions for adding and deleting submenus and menuitems in runtime (16KB)211,gradientmenu.zipCreate Popup menus in MFC with a gradient and text on the left side (89KB)212,menuicon_demo.zipGive your apps a unique look by adding a logo to your menu(48KB)213,bcgbappwizard.zipBCGControlBar library version 4.6(2121KB)214,mpcstatusbar.zipAn enhanced CStatusBar to easily and dynamically add/remove controls on a status bar (48KB)215,textonlystatusbar.zipAn easy to use and implement Text Only Status Bar with Tool tip text extracted from the status bar panes. (39KB)216,progressbar.zipShowing progress bar in a status bar pane(33KB)217,sizecbar_src.zipDevStudio-like docking window (64KB)218,sizing_tabct1_demo.zipCreates a dockable and resizable control bar. (46KB)219,dockview.zipA fairly simple way to incoporate views into sizing control bars(69KB)220,spin_slide_toolbar.zipHow to create toolbars with spinners and/or sliders(48KB)221,tearoffrebars_prj.zipThis article Implements the functionality similar to the Office 2000 toolbars(26KB)222,flatbar.zipA flat toolbar implementation that does not require the updated common controls library from Internet Explorer. (197KB)223,toolbar_droparrow_demo.zipDemonstrates how to use the new toolbar styles to add dropdown arrows to toolbar buttons (28KB)224,dynamictb.zipA simple tutorial that shows how to dynamically replace toolbars at runtime (35KB)225,toolbar_docking_demo.zipDemonstrates how to dock toolbars side-by-side (29KB)226,tapetoolbar.zipA spectacular variation on toolbars (35KB)227,chevions.zipAn introduction to using the cool new toolbar chevrons (18KB)228,toolgroupmanager.zipA reusable template class for managing multiple toolbars, only one of which is displayed at a time(30KB)229,toolbar_hotbuttons_demo.zipDemonstrates how to add rollover buttons to your toolbar(30KB)230,toolbar.zipWTL Tool Bar Drop-Down Extension(64KB)231,win95asm.zipIntroduction to Menus(113KB)232,outbar.zipCGfxOutBarCtrl, an Outlook98 bar-like control(163KB)233,tabstatus.zipAdvanced UI - MDI list in the status bar (and a custom Window List dialog)(62KB)234,gfxlist.zipList Control - Enhanced list control(1544KB)235,maillook.zipInternet Mail Look(42KB)236,cdxcdynamic.zipDynamic child window repositioning for dialogs, property sheets, form views and any other CWnd derived classes. (227KB)237,voicecmd.zipVoice Command Enabling Your Software (27KB)238,cj60lib.zipMFC Extension Library - CJ60 Version 6.07(1100KB)239,infobar.zipInformation Bar (62KB)240,switcher.zipA Switcher Control (like the Windows Task Bar) (40KB)
在DXF文件,我们最关心的是如何得到模型上各个点的坐标,并且用这些点连成许多个三用形,构成面,进而绘制出整个模型。在DXF文件的结构,我们已经看到,DXF文件先叙述实体上各个点的坐标,然后叙述实体上有多少个面,每个面由哪些点构成。这样,我们至少需要2个数组来存储一个实体的信息,一个用于存储点的坐标,一个用于存储点序,我们可以把这2个数组放到一个结构,如果模型实体的数目不止一个是,我们就用这个结构来定义一个数组。在本文,我们使用      Visual C++ 6.0 来写一个读取DXF文件的小程序。     在实际应用,模型实体的数目以及实体点和面的数目都是不定的,为了有效地利用内存,我们选择MFC类库的聚合类CobArray类所创建的对象vertex,      sequence来存储和管理实体的点坐标和点序。     CObArray类是一个用来存放数组类的聚合类,它能根据要存进来的数组(或结构)多少自动进行自身大小的高速,而且这个类本身具有的成员函数使得我们对它的对象的操作更加方便、快捷,用它编的程序也易于读懂。     三维实体模型的模型信息的一部分信息可以在标题段读出,通过读取变量名为$UCSORG的三个变量,可以得到三维实体在世界坐标系自身所定义的用户坐标系原点的三维坐标。通过读取$EXTMAX,$EXTMIN可以获知三维实体在世界坐标系的范围,而其它部分的信息只有读完了全部DXF文件后才可以通过计算确定。对于三维实体模型的全部点坐标、点序,可以在实体段按照前面介绍的DXF文件基本结构读出。现

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧