GetWindowDC

GetWindowDC函式:返回hWnd參數所指定的視窗的設備環境。

基本介紹

  • 中文名:GetWindowDC
  • 性質:指定的視窗的設備環境
  • 相關:需要調用ReleaseDC釋放設備環境
  • 類型:函式
簡介,函式原型,

簡介

獲得的設備環境覆蓋了整個視窗(包括非客戶區),例如標題欄、選單、滾動條,以及框線。這使得程式能夠在非客戶區域實現自定義圖形,例如自定義標題或者框線。當不再需要該設備環境時,需要調用ReleaseDC函式釋放設備環境。注意,該函式只獲得通用設備環境,該設備環境的任何屬性改變都不會反映到視窗的私有或者類設備環境中(如果視窗有的話)!

函式原型

HDC GetWindowDC(HWNDhWnd // 視窗句柄);
api函式名(function):GetWindowDC
GetWindowDC 別名(alias):
GetWindowDC 庫名(library):User32
GetWindowDC 作業系統(os):Requires Windows NT 3.1 or later; Requires Windows 95 or later
GetWindowDC 參數表(parameter):
hwnd ----------- Long,將獲取其設備場景的視窗?
hWndIdentifies the window with a device context that is to be retrieved.
GetWindowDC 返回值(return):
Long,執行成功為視窗設備場景,失敗則為0
If the function succeeds, the return value is the handle of a device context for the specified window. If the function fails, the return value is NULL, indicating an error or an invalid hWnd parameter.
GetWindowDC 說明(description):
獲取整個視窗(包括框線、滾動條、標題欄、選單等)的設備場景
The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.
GetWindowDC 聲明(declare):
Declare Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As Long) As Long GetWindowDC 例程(example):
Draw On ScreenWindowFromPointUsing Small Fonts
GetWindowDC .net對應函式(dotnet):
System.Windows.Forms.Form.CreateGraphics.GetHdc
GetWindowDC .net例程(dotnetexample):
GetWindowDC 相關函式(related):
GetDCWindowFromDC
不推薦在vb里使用這個函式。用完後一定要用ReleaseDC函式釋放場景

熱門詞條

聯絡我們