zoukankan      html  css  js  c++  java
  • 设备内容(DC)

    • 定义:
      • 设备内容(简称为「DC」)实际上是GDI内部保存的数据结构。设备内容与特定的显示设备(如视讯显示器或打印机)相关。
    • 作用:
      • 当您想在一个图形输出设备(诸如屏幕或者打印机)上绘图时,您首先必须获得一个设备内容(或者DC)的句柄。将句柄传回给程序时,Windows就给了您使用设备的权限。然后您在GDI函数中将这个句柄作为一个参数,向Windows标识您想在其上进行绘图的设备。
    • 分类(摘自这里):
      • Client DC
        • A client DC is associated with a particular window, and will give the developer access to the client area of the target window. This is the type of DC that is used most often by application programmers, and is the easiest to handle. This is the type of DC that should be used when the WM_PAINT message is handled. This is also the only DC that will be explained with any amount of detail.
      • Window DC
        • A window DC is associated with a particular window, and allows the developer to draw on any part of the target window, including the borders and the caption. This is the type of DC that is sent with WM_NCPAINT message.
      • Memory DC
        • A Memory DC is a DC that exists only in memory, and is not associated with any window. This is the only type of DC that can hold a user defined bitmap (HBITMAP). Memory DC's are very useful for caching images, and for use with backbuffers on complicated displays.
      • General Device DC
        • For lack of a better name, this type of DC covers all of the other devices that it is possible to get a DC from. For instance, a printer or a plotter, the entire display monitor, or even custom device that a cutting-edge technology company may invent that does not even exist yet. The fact is, a DC can be created for any device that supports the required API functions defined by Microsoft.
    • 取得设备内容句柄
      • 在处理WM_PAINT消息时,使用BeginPaintEndPaint(窗口无效区域)
      • 非WM_PAINT消息时,使用GetDCReleaseDC(窗口显示区域,hWnd==NULL则为显示器DC)
      • 非WM_NCPAINT消息时,使用GetWindowDCReleaseDC(整个窗口区域,包括非显示区)
      • 取得某个设备(显示器或打印机)的DC句柄,使用CreateDCDeleteDC
      • 取得一个「信息内容」的句柄,使用CreateICDeleteDC
      • 取得一个「内存设备内容」的句柄,使用CreateCompatibleDCDeleteDC
      • metafile设备内容
    • 参考:《Windows程序设计》
  • 相关阅读:
    hive基本操作与应用
    用mapreduce 处理气象数据集
    熟悉常用的HBase操作,编写MapReduce作业
    爬虫大作业
    第三章 熟悉常用的HDFS操作
    数据结构化与保存
    获取全部校园新闻
    爬取校园新闻首页的新闻的详情,使用正则表达式,函数抽离
    网络爬虫基础练习
    Hadoop综合大作业
  • 原文地址:https://www.cnblogs.com/dahai/p/2101600.html
Copyright © 2011-2022 走看看