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

SetWindowRgn

发布时间:2023-09-14 01:19:09

SetWindowRgn,计算机术语,该函数用来设置一个窗口的区域。

SetWindowRgn介绍

SetWindowRgn,计算机术语,该函数用来设置一个窗口的区域。

SetWindowRgn

SetWindowRgn定义

int SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw);

int SetWindowRgn(HRGN hRgn,BOOL bRedraw);

//在VC6.0基于对话框时候,该函数是这样的,有两个参数

SetWindowRgn说明

The SetWindowRgn function sets the window region of a window. The window region determines the area within the window where the system permits drawing. The system does not display any portion of a window that lies outside of the window region

SetWindowRgn只有被包含在这个区域内的地方才会被重绘,而不包含在区域内的其他区域系统将不会显示.

When this function is called, the system sends the WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages to the window.

当这个函数被调用时,系统会发出 WM_WINDOWPOSCHANGING 和 WM_WINDOWPOSCHANGED 这两个消息

The coordinates of a window's window region are relative to the upper-left corner of the window, not the client area of the window.

它所设置的区域是从最左上角开始的,而不是从 用户区域 开始的.(既是说从标题栏那里就已经生效了)

After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn. The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle. In particular, do not delete this region handle. The system deletes the region handle when it no longer needed.

当成功调用了这个函数之后,系统会直接使用这个Rgn,而且系统不会再次将它复制一份.

而且哦,我们没有必要自行释放这个区域的句柄.当它再也不起作用的时候,系统会自动释放它.

To obtain the window region of a window, call the GetWindowRgn function.

可以使用 GetWindowRgn 来获取一个窗口的作用区域.

SetWindowRgn参数

hWnd

Handle to the window whose window region is to be set.

窗口的句柄

SetWindowRgn

hRgn

Handle to a region. The function sets the window region of the window to this region.

If hRgn is NULL, the function sets the window region to NULL.

指向的区域.函数起作用后将把窗体变成这个区域的形状.

如果这个参数是空值,窗体区域也会被设置成空值,也就是什么也看不到.

bRedraw

Specifies whether the system redraws the window after setting the window region. If bRedraw is TRUE, the system does so; otherwise, it does not.

Typically, you set bRedraw to TRUE if the window is visible.

这个参数是用于设置 当函数起作用后,窗体是不是该重绘一次. true 则重绘,false 则相反.

如果你的窗体是可见的,通常建议设置为 true.

SetWindowRgn返回值

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Windows NT/2000/XP: To get extended error information, call GetLastError.

如果函数执行成功,就返回非零的数字.如果失败,就返回零.

在 Windows NT/2000/XP 下,想要得到更多的错误信息,可以调用 GetLastError.

SetWindowRgn系统要求

Windows NT/2000/XP: 包括 Windows NT 3.51 在内的以后的版本.

Windows 95/98/Me: 包括 Windows 95 在内的以后的版本.

SetWindowRgn

Header: Declared in Winuser.h; include Windows.h.

头文件在 Winuser.h 中声明了这个函数,当然在 Windows.h 也有.

Library: Use User32.lib.

所属的链接库在 User32.lib

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