欢迎来到天天文库
浏览记录
ID:40239547
大小:592.50 KB
页数:71页
时间:2019-07-28
《Visual C++ 6.0实例教程 第7章》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第7章MFC通用类内容摘要:1.MFC中数组类的使用方法2.MFC中链表类的使用方法3.MFC中字符串类CString的使用方法4.MFC中日期和时间类的使用方法5.MFC中CPoint类、CSize类和CRect类的使用方法返回目录7.1数组类学习目标1.了解MFC中的数组类及其常用成员函数。2.利用MFC中的数组类处理数据。7.1返回第7章CByteArray:CDWordArray:CPtrArray:CUIntArray:CWordArray:CStringArray:7.1MFC的数组类1.intAd
2、d(ARG_TYPEnewElement);throw(CMemoryException);2.TYPE&ElementAt(intnIndex);3.voidFreeExtra();4.TYPEGetAt(intnIndex)const5.intGetSize()const;6.intGetUpperBound()const;7.(1)voidInsertAt(intnIndex,ARG_TYPEnewElement,intnCount=1);throw(CMemoryException);(2)voidIn
3、sertAt(intnStartIndex,CArray*pNewArray);throw(CMemoryException);8.voidRemoveAll();9.voidSetAt(intnIndex,ARG_TYPEnewElement);10.voidSetAtGrow(intnIndex,ARG_TYPEnewElement);throw(CMemoryException);11.voidSetSize(intnNewSize,intnGrowBy=-1);throw(CMemoryExceptio
4、n);7.1MFC数组类的常用成员函数例题(1--2)7.11.创建一个基于单文档的应用程序(Array)2.编辑对话框资源IDD_DIALOG_ADDIDC_STATICGroupBoxCaption:设置添加操作IDC_RADIO_SETRadioButtonCaption:设置,Group:选中IDC_RADIO_ADDRadioButtonCaption:添加IDC_RADIO_INSERTRadioButtonCaption:插入IDC_STATICStaticTextCaption:数组元素下标ID
5、C_EDIT_INDEXEditBoxIDC_STATICStaticTextCaption:设置值IDC_EDIT_VALUEEditBoxIDOKButtonCaption:确定IDCANCELButtonCaption:取消关联变量:IDC_RADIO_SETintm_nRidioIDC_EDIT_INDEXintm_nIndexIDC_EDIT_VALUECStringm_strValue例题(2)7.1(2)IDD_DIALOG_ADDIDC_STATICGroupBoxCaption:设置添加操作I
6、DC_RADIO_ALLRadioButtonCaption:全部元素,Group:选中IDC_RADIO_ELEMENTRadioButtonCaption:指定元素IDC_STATICStaticTextCaption:数组下标IDC_EDIT_VALUEEditBoxIDOKButtonCaption:确定IDCANCELButtonCaption:取消关联变量:IDC_RADIO_ALLintm_nRidioIDC_EDIT_VALUEintm_nIndex例题(3)7.13.为对话框IDD_DIALO
7、G_ADD添加响应函数BOOLCDlgAdd::OnInitDialog(){CDialog::OnInitDialog();//TODO:Addextrainitializationhere((CButton*)GetDlgItem(IDC_RADIO_SET))->SetCheck(1);returnTRUE;//returnTRUEunlessyousetthefocustoacontrol//EXCEPTION:OCXPropertyPagesshouldreturnFALSE}voidCDlgAdd:
8、:OnRadioSet(){//TODO:AddyourcontrolnotificationhandlercodehereGetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true);}例题(3)7.1voidCDlgAdd::OnRadioAdd(){//TODO:AddyourcontrolnotificationhandlercodehereGe
此文档下载收益归作者所有