本站首页    管理页面    写新日志    退出


 

 

 


最新日志

练车
今天是2011年07月02号
温馨
CInternetSession 类
CHttpFile实现Get/Post
在MFC中加一个控制台DOS界面
strtol 函数
outputParam
有关CTime和ColeDateTime
variant_t ,_bstr_t 与

 


 

最近的评论

回复:CHttpFile实现Get/Po
回复:好久没有来了
回复:参数自整定的模糊PID
回复:电子设计大赛自由命题可参考的题目
回复:数字万用表使用方法
回复:公交车上巨搞笑的一幕
回复:电子设计大赛自由命题可参考的题目
回复:电子设计大赛自由命题可参考的题目
回复:电子设计大赛自由命题可参考的题目
回复:暑假回来

 


 

连接




    

The Device Context
sccwqiang 发表于 2008-2-21 20:58:31

                      The Device Context    A handle, you'll recall, is simply a number that Windows uses for internal reference to an object. You obtain the handle from Windows and then use the handle in other functions. The device context handle is your window's passport to the GDI functions. With that device context handle you are free to paint your client area and make it as beautiful or as ugly as you like. The device context (also called simply the "DC") is really just a data structure maintained internally by GDI. A device context is associated with a particular display device, such as a video display or a printer. For a video display, a device context is usually associated with a particular window on the display. Some of the values in the device context are graphics "attributes." These attributes define some particulars of how GDI drawing functions work. With TextOut, for instance, the attributes of the device context determine the color of the text, the color of the text background, how the x-coordinate and y-coordinate in the TextOut function are mapped to the client area of the window, and what font Windows uses when displaying the text. When a program needs to paint, it must first obtain a handle to a device context. When you obtain this handle, Windows fills the internal device context structure with default attribute values. As you'll see in later chapters, you can change these defaults by calling various GDI functions. Other GDI functions let you obtain the current values of these attributes. Then, of course, there are still other GDI functions that let you actually paint the client area of the window. After a program has finished painting its client area, it should release the handle. When a program releases the handle, the handle is no longer valid and must not be used. The program should obtain the handle and release the handle during the processing of a single message. Except for a device context created with a call to CreateDC (a function I won't discuss in this chapter), you should not keep a device context handle around from one message to another. Windows applications generally use two methods for getting a device context handle in preparation for painting the screen.    可知其实设备上下文是指的一种数据结构,是由图形设备接口内部所维护的,通常与特定的显示设备有关系,例如显示器,打印机.对于显示器来说,Device Context就和显示的特定的窗口有关. 设备上下文就是绘图的一些"属性值" 要想使用GDI绘图必须先要得到Device Context Handle,之后,WINDOW会以确省的值去真充Divece Context数据结构中的数据,在之后,我们就可以调用一些GDI的一些函数去改变这些值.

阅读全文(1151) | 回复(0) | 编辑 | 精华


发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)

 

 

 


站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.031 second(s), page refreshed 144336682 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号