当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

《Visual C++ 6.0实例教程》教学资源(PPT课件讲稿)第7章 MFC通用类

资源类别:文库,文档格式:PPT,文档页数:70,文件大小:269KB,团购合买
第7章MFC通用类 内容摘要: 1.MFC中数组类的使用方法 2MFC中链表类的使用方法 3MFc中字符 CString串类的使用方法 4M中日期和时间类的使用方法 5.mfc中CPoint类、 CSizeCRect类和类的使
点击下载完整版文档(PPT)

第7章MFC通用类 内容摘要: 1MFC中数组类的使用方法 2MFC中链表类的使用方法 3MFC中字符串类 CString的使用方法 4MFC中日期和时间类的使用方法 5MFC中 CPoint类、CSie类和 CRect类的使 用方法

第7章 MFC通用类 内容摘要: 1. MFC中数组类的使用方法 2. MFC中链表类的使用方法 3. MFC中字符串类CString的使用方法 4. MFC中日期和时间类的使用方法 5.MFC中CPoint类、CSize类和CRect类的使 用方法 返回目录

7.1 71数组类 学习目标 了解MFC中的数组类及其常用成员函数。 2利用MFC中的数组类处理数据

7.1 数组类 学习目标 1.了解MFC中的数组类及其常用成员函数。 2.利用MFC中的数组类处理数据。 7.1 返回第7章

7.1 MFC的数组类 CByteArray: CD Wordarray CPtrarray CUIntarray C Wordarray CString array

CByteArray: CDWordArray: CPtrArray: CUIntArray: CWordArray: CStringArray: 7.1 MFC的数组类

MFC数组类的常用成员函数 7.1 1. int Add (ARG TYPE newElement ) throw( CMemory Exception 2. TYPE& ElementAt int nIndex 3. void FreeExtra ( 4. TYPE GetAt int nIndex) const 5. int get Size() const 6. int GetUpper Bound ()const 7.(1 )void InsertAt( int nIndex, ARG TYPE newElement, int nCount=1 throw( CMemory Exception (2 )void InsertAt int n StartIndex, C Array* pNewArray throw( CMemory Exception 8. void removeAll() 9. void SetAt int nIndex ARG TYPE newElement 10. void SetAtGrow( int nIndex, ARG TYPe newElement ) throw CMemory Exception void SetSize( int nNewSize, int nGrowBy ). throw CMemory Exception

1.int Add(ARG_TYPE newElement); throw(CMemoryException ); 2.TYPE& ElementAt(int nIndex ); 3.void FreeExtra(); 4.TYPE GetAt( int nIndex ) const 5.int GetSize( ) const; 6.int GetUpperBound() const; 7.(1)void InsertAt( int nIndex, ARG_TYPE newElement, int nCount= 1 ); throw(CMemoryException ); (2)void InsertAt( int nStartIndex,CArray* pNewArray ); throw(CMemoryException ); 8.void RemoveAll( ); 9.void SetAt( int nIndex, ARG_TYPE newElement ); 10 . void SetAtGrow ( int nIndex, ARG_TYPE newElement ) ; throw ( CMemoryException ); 11 . void SetSize ( int nNewSize, int nGrowBy = -1 ) ; throw ( CMemoryException ); 7.1 MFC数组类的常用成员函数

例题(1-2) 7.1 1.创建一个基于单文档的应用程序(Aray) 2编辑对话框资源 (1)IDD DIALOG ADD IDC STATIC Group box Caption:设置添加操作 IDC RADIO SET Radio button Caption:设置, Group:选 IDC RADIO ADD Radio button Caption:添加 IDC RADIO INSERT Radio button Caption:插入 IDC STATIC Static Text Caption:数组元素下标 IDC EDIT INDEX Edit box IDC STATIC Static Text Caption:设置值 IDC EDIT VALUE Edit box IDOK Button Caption:确定 IDCANCEL Button Caption:取消 关联变量 IDC RADIO SET int m nridio IDC EDIT INDEX m nindex IDC EDITⅤALUE CString m str value

例题(1--2) 7.1 1.创建一个基于单文档的应用程序(Array) 2.编辑对话框资源 (1) IDD_DIALOG_ADD IDC_STATIC Group Box Caption:设置添加操作 IDC_RADIO_SET Radio Button Caption:设置,Group:选 中 IDC_RADIO_ADD Radio Button Caption:添加 IDC_RADIO_INSERT Radio Button Caption:插入 IDC_STATIC Static Text Caption:数组元素下标 IDC_EDIT_INDEX Edit Box IDC_STATIC Static Text Caption:设置值 IDC_EDIT_VALUE Edit Box IDOK Button Caption:确定 IDCANCEL Button Caption:取消 关联变量: IDC_RADIO_SET int m_nRidio IDC_EDIT_INDEX int m_nIndex IDC_EDIT_VALUE CString m_strValue

7.1 例题(2) (2)IDD DIALOG ADD IDC STATIC Group Box Caption:设置添加操作 IDC RADIO ALL Radio Button Caption:全部元素,(roup:选中 IDC RADIO ELEMENT Radio Button Caption:指定元素 IDC STATIC Static Text Caption:数组下标 IDC EDITⅤALUE Edit box IDOK Button Caption:确定 IDCANCEL Button Caption:取消 关联变量: IDC RADIO ALI int m radio IDC EDIT VALUE Int m nIndex

例题(2) 7.1 (2) IDD_DIALOG_ADD IDC_STATIC Group Box Caption:设置添加操作 IDC_RADIO_ALL Radio Button Caption:全部元素,Group:选中 IDC_RADIO_ELEMENT Radio Button Caption:指定元素 IDC_STATIC StaticText Caption:数组下标 IDC_EDIT_VALUE Edit Box IDOK Button Caption:确定 IDCANCEL Button Caption:取消 关联变量: IDC_RADIO_ALL int m_nRidio IDC_EDIT_VALUE int m_nIndex

例题(3) 7.1 3.为对话框 IDD DIALOG ADD添加响应函数 BOOL CDIgAdd: OnI Dialogo CDialog: OnlnitDialogo M/ TODO: Add extra initialization here ((CButton")GetDIgltem(IDC RADIO SED)->Setcheck(1) return TRUE; / return TRUE unless you set the focus to a control l EXCEPTION: OCX Property Pages should return FALSE void CDIgAdd On Radio Seto //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT INDEX)->EnableWindow(true);

例题(3) 7.1 3.为对话框IDD_DIALOG_ADD添加响应函数 BOOL CDlgAdd::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here ((CButton*)GetDlgItem(IDC_RADIO_SET))->SetCheck(1); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDlgAdd::OnRadioSet() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true); }

例题(3) 7.1 void CDIgAdd: OnRadio Addo //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT_ INDEX)->EnableWindow(false); void cCDIgAdd: On Radiolnserto //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT INDEX)->EnableWindow(true) void CDIgAdd: OnOKo /TODO: Add extra validation here Update Data(true); CDialog: OnOKo

例题(3) 7.1 void CDlgAdd::OnRadioAdd() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(false); } void CDlgAdd::OnRadioInsert() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true); } void CDlgAdd::OnOK() { // TODO: Add extra validation here UpdateData(true); CDialog::OnOK(); }

例题(4) 7.1 4.为对话框 IDD DIALOG DELETE添加响应函数 BOOL CDlgDelete: OnInitDialogo CDialog: OnlnitDialogo // TODO: Add extra initialization here ((CButton*)GetDlgItem(IDC RADIO_ ALL)->Set check(1) GetDlgltem(IDC EDIT INDEX)->EnableWindow(false) return TRUE; /return TRUE unless you set the focus to a control //EXCEPTION: OCX Property Pages should return FALSE void CDlgDelete: OnRadioElemento //TODO: Add your control notification handler code here GetDlgltem(IDC EDIT INDEX)->Enable Window(true)

例题(4) 7.1 BOOL CDlgDelete::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here ((CButton*)GetDlgItem(IDC_RADIO_ALL))->SetCheck(1); GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(false); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDlgDelete::OnRadioElement() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true); } 4.为对话框IDD_DIALOG_DELETE添加响应函数

7.1 例题(4) void CDigDelete: OnRadIoAlo //TODO: Add your control notification handler code here GetDIgltem(IDC EDIT INDEX)->EnableWindow(false) void CDlgDelete: OnOKo l/ TODO: Add extra validation here Update Data(true) CDialog: OnOKo

例题(4) 7.1 void CDlgDelete::OnRadioAll() { // TODO: Add your control notification handler code here GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(false); } void CDlgDelete::OnOK() { // TODO: Add extra validation here UpdateData(true); CDialog::OnOK(); }

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共70页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有