兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第7章 MFC通用类

第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(); }
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第6章 文件操作.ppt
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第5章 图形操作.ppt
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第4章 菜单、快捷键和控制条.ppt
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第3章 对话框与控件.ppt
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第2章 文档和视.ppt
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)目录.ppt
- 《计算机文化基础》课程PPT教学课件:课堂提问3.ppt
- 《计算机文化基础》课程PPT教学课件:课堂提问2.ppt
- 《计算机文化基础》课程PPT教学课件:课堂提问.ppt
- 《计算机文化基础》课程PPT教学课件:第五讲 文字处理系统Word2000.ppt
- 《计算机文化基础》课程PPT教学课件:PowerPoint.ppt
- 《计算机文化基础》课程PPT教学课件:复习.ppt
- 《计算机文化基础》课程PPT教学课件:Exce电子表格.ppt
- 《计算机文化基础》课程PPT教学课件:计算机网络基础.ppt
- 《计算机文化基础》课程PPT教学课件:计算机信息系统安全.ppt
- 《计算机文化基础》课程PPT教学课件:第四讲 WINDOW使用基础.ppt
- 《计算机文化基础》课程PPT教学课件:第三讲 操作系统发展与DOS.ppt
- 《计算机文化基础》课程PPT教学课件:第二讲 计算机工作原理与数字信息编码.ppt
- 《计算机文化基础》课程PPT教学课件:第一讲 计算机的发展与应用.ppt
- 《局域网技术》课程PPT教学课件(组网工程)07 综合布线系统.ppt
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第8章 常处理和诊断.ppt
- 兰州交通大学:《Visual 6.0实例教程》课程教学资源(PPT课件)第9章 多线程.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 01 绪论.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 10 网络安全解决方案.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 02 物理安全.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 03 信息加密与PKI.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 04 防火墙技术.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 05 入侵检测技术.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 06 访问控制技术.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 07 网络安全检测与评估技术.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 08 计算机病毒防范技术.ppt
- 《计算机网络安全技术教程》教学资源(PPT课件讲稿)ch 09 备份技术.ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)绪论(主讲:陈向群).ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)第一章 操作系统概述.ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)第十章 分布式系统中的同步问题.ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)第十一章 分布式系统中的进程及处理器.ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)第十二章 分布式文件系统.ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)第二章 进程管理.ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)第三章 用户接口与作业管理.ppt
- 北京大学计算机系:《操作系统原理 Principles of Operating System》课程教学资源(PPT课件讲稿)第四章 存储管理.ppt