VC++程序设计_AnlexVC++3(英文)

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts o This hands-on chapter shows you how to build a mfc library application working with only the view element o How to use Graphics Device Interface(GDI) How to use resource editor Debug target vs. Release Target Understand Diagnostic Macros o Understand the Precompiled Headers
VC++ Programming @ UESTC 1 Chapter 5 The Graphics Device Interface , Color and Fonts ⚫ This hands-on chapter shows you how to build a MFC library application working with only the view element. ⚫ How to use Graphics Device Interface (GDI) ⚫ How to use Resource Editor ⚫ Debug Target vs. Release Target ⚫ Understand Diagnostic Macros ⚫ Understand the Precompiled Headers

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts Windows class and C++ object and how to related them together o Device context classes revisited GDI Objects Windows Color Mapping ● Fonts
VC++ Programming @ UESTC 2 ⚫ Windows Class and C++ Object and how to related them together ⚫ Device Context Classes revisited ⚫ GDI Objects ⚫ Windows Color Mapping ⚫ Fonts Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts o typedef struct tag WNDCLAS UINT WNDPROC lpfn WndProc cbClsextra cbWndExtra HINSTANCE hInstance HICON hIcon cURSOr hCurso HBRUSH hbr Background LPCSTR lpszMenuName LPCSTR lpszclassName; 3 WNDCLASS 3
VC++ Programming @ UESTC 3 ⚫ typedef struct tagWNDCLASS { UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; } WNDCLASS; Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts o The mfC classes wrap Windows object handles with C++ objects For example, each C++ device context object has an associated hdc handle Associate the two wrapper class and the handle to the windows object by calling Attach
VC++ Programming @ UESTC 4 ⚫ The MFC classes wrap Windows object handles with C++ objects. For example, each C++ device context object has an associated HDC handle. Associate the two wrapper class and the handle to the windows object by calling Attach. Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts For example C Wnd my Wnd my Wnd Attach(h Wnd) This makes an entry in the permanent map associating myWnd and hwnd When myW'nd is deleted, the destructor will automaticall destroy the hWnd by calling the Windows Destroy Window function If this is not desired. the hwnd must be detached from myWnd before the myWnd object is destroyed(normally when leaving the scope at which myWnd was defined)
VC++ Programming @ UESTC 5 For example: CWnd myWnd; myWnd.Attach(hWnd); This makes an entry in the permanent map associating myWnd and hWnd. When myWnd is deleted, the destructor will automatically destroy the hWnd by calling the Windows DestroyWindow function. If this is not desired, the hWnd must be detached from myWnd before the myWnd object is destroyed (normally when leaving the scope at which myWnd was defined). Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts Device context is the key gdi element that represents a physical device e The mfc cdc class has all the member functions that you ll need for drawing Except for the CMetaFiledC class, derived classes are distinct only in their constructor and destructor o For display and printer device context objects, framework attaches the handle to the object For memory device context, you must call a member function to attach the handle after construction
VC++ Programming @ UESTC 6 ⚫ Device context is the key GDI element that represents a physical device. ⚫ The MFC CDC class has all the member functions that you’ll need for drawing. ⚫ Except for the CMetaFileDC class, derived classes are distinct only in their constructor and destructor. ⚫ For display and printer device context objects, framework attaches the handle to the object. ⚫ For memory device context, you must call a member function to attach the handle after construction. Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming@UESTC Chapter 5 The Graphics Device Interface Color and Fonts o The Display Context Classes CClientDC and CWindowDC e CClientdc does not include menu bar. toolbar status bar and scroll bar o CWindowdC is more applicable to the frame windows than it is to the view windows
VC++ Programming @ UESTC 7 ⚫ The Display Context Classes CClientDC and CWindowDC ⚫ CClientDC does not include menu bar, toolbar, status bar and scroll bar. ⚫ CWindowDC is more applicable to the frame windows than it is to the view windows Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts Properly handle cdc object to release the windows resource Construct object object the stack void CMy View: OnLButton Down qUiNT nFlags Cpoint point) CRect rect CClientDC dc(this); / from stack dc. GetClipBox(rect):i//dc automatically released 2. Use CWnd: GetDC….. OnlButtondown(….){ Crect rect CDC* pDC= GetDCO ReleaseD(pDc); 3. You must not to destroy Cdc object passed by OnDraw. Let framework does it for you
VC++ Programming @ UESTC 8 ⚫ Properly handle CDC object to release the windows resource. 1. Construct object object the stack void CMyView::OnLButtonDown(UINT nFlags, Cpoint point) { CRect rect; CClientDC dc(this); // from stack dc.GetClipBox(rect); }// dc automatically released 2. Use CWnd::GetDC ….. OnLButtonDown(….) { Crect rect; CDC* pDC = GetDC(); …. ReleaseDC(pDC); } 3. You must not to destroy CDC object passed by OnDraw. Let framework does it for you. Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts e The State of the device Context What you see on screen or printer depends on the current state of device context Attached GDI drawing objects such as pens bruhes and fonts 2. The mapping mode that determines the scale of items then they are drawn 3. Various details such as alignment parameters and polygon filling mode
VC++ Programming @ UESTC 9 ⚫ The State of the Device Context What you see on screen or printer depends on the current state of device context. 1. Attached GDI drawing objects such as pens, bruhes and fonts. 2. The mapping mode that determines the scale of items then they are drawn. 3. Various details such as alignment parameters and polygon filling mode. Chapter 5 The Graphics Device Interface , Color and Fonts

VC++ Programming UESTC Chapter 5 The Graphics Device Interface Color and Fonts ● GDI Objects CGdiObject is the abstract base class for the gDi classes Derived Classes for Windows GDI objects Class windows handle type CPen HPEN CBrush HBRUSH CFont HFONT CBitmap HBITMAP PAlette HPALETTE CR HRGN 10
VC++ Programming @ UESTC 10 ⚫ GDI Objects CGdiObject is the abstract base class for the GDI classes. Derived Classes for Windows GDI Objects Class Windows handle type CPen HPEN CBrush HBRUSH CFont HFONT CBitmap HBITMAP CPalette HPALETTE CRgn HRGN Chapter 5 The Graphics Device Interface , Color and Fonts
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- VC++程序设计_AnlexVC++2(英文).ppt
- VC++程序设计_AnlexVC++1(英文).ppt
- 电子科技大学《Delphi程序设计》_面向对象程序设计基础.ppt
- 电子科技大学《Delphi程序设计》_认识delphi.ppt
- 电子科技大学《Delphi程序设计》_delphi语法基础.ppt
- 电子科技大学《Delphi程序设计》_delphi组件.ppt
- 电子科技大学《Delphi程序设计》_delphi应用.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第9章 预处理命令.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第8章 函数.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第7章 数组.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第6章 循环控制.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第5章 选择结构程序设计.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第4章 最简单的C程序设计一顺序程序设计.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第3章 数据类型、运算符与表达式.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第2章 程序的灵魂一算法.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第1章 C语言概述.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第13章 文件.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第12章 位运算.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第11章 结构体与共用体.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第10章 指针.ppt
- VC++程序设计_AnlexVC++4(英文).ppt
- VC++程序设计_AnlexVC++5(英文).ppt
- VC++程序设计_AnlexVC++6(英文).ppt
- VC++程序设计_VisualC++(英文).doc
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)目录.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第10章 中间件技术.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第11章 数据库与WWW.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第12章 XML技术.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第1章 数据库概论.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第2章 关系模型和关系运算理论.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第3章 关系数据库语言SQL.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第4章 关系数据库的规范化设计.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第5章 数据库设计和ER模型.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第6章 数据库的存储结构.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第7章 系统实现技术.ppt
- 复旦大学:《数据库系统教程》电子教案(PPT教学课件)第9章 分布式数据库系统.ppt
- 太原广播电视大学《计算机应用基础》课程教学课件(PPT讲稿).ppt
- 桂林电子科技大学:《数据结构》课程电子教案(PPT课件)第一章 绪论、第二章 线性表及其顺序存储结构.ppt
- 桂林电子科技大学:《数据结构》课程电子教案(PPT课件)第七章 查找技术.ppt
- 桂林电子科技大学:《数据结构》课程电子教案(PPT课件)第三章 线性链表.ppt