設備内容(DC)

2398 ワード

  • 定義:
  • デバイスコンテンツ(略称「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メッセージの場合、BeginPaintとEndPaint(ウィンドウ無効領域)
  • を使用します.
  • 非WM_PAINTメッセージの場合、GetDCとReleaseDC(ウィンドウ表示領域、hWnd=NULLはディスプレイDC)
  • を使用する
  • 非WM_NCPAINTメッセージは、GetWindowDCおよびReleaseDC(非表示領域を含むウィンドウ領域全体)
  • を使用する.
  • あるデバイス(ディスプレイまたはプリンタ)のDCハンドルを取得し、CreateDCおよびDeleteDC
  • を使用する.
  • 「情報コンテンツ」のハンドルを取得し、CreateICとDeleteDC
  • を使用します.
  • 「メモリデバイスコンテンツ」のハンドルを取得し、CreateCompatibledDCとDeleteDC
  • を使用します.
  • metafileデバイスコンテンツ
  • 参考:『Windowsプログラミング』