当前位置:首页 科普知识 GetWindowDC

GetWindowDC

发布时间:2023-09-14 18:23:57

GetWindowDC函数:返回hWnd参数所指定的窗口的设备环境。

GetWindowDC介绍

GetWindowDC函数:返回hWnd参数所指定的窗口的设备环境。

GetWindowDC

GetWindowDC简介

获得的设备环境覆盖了整个窗口(包括非客户区),例如标题栏、菜单、滚动条,以及边框。这使得程序能够在非客户区域实现自定义图形,例如自定义标题或者边框。当不再需要该设备环境时,需要调用ReleaseDC函数释放设备环境。注意,该函数只获得通用设备环境,该设备环境的任何属性改变都不会反映到窗口的私有或者类设备环境中(如果窗口有的话)!

GetWindowDC函数原型

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):

GetWindowDC

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

GetWindowDC .net例程(dotnetexample):

GetWindowDC 相关函数(related):

GetDCWindowFromDC

不推荐在vb里使用这个函数。用完后一定要用ReleaseDC函数释放场景

温馨提示:
本文【GetWindowDC】由作者 爱百科 转载提供。 该文观点仅代表作者本人, 自学教育网 信息发布平台,仅提供信息存储空间服务, 若存在侵权问题,请及时联系管理员或作者进行删除。
(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6