說明,定義,參數,返回值,說明,系統要求,
說明
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 函式是設定了一個視窗的區域.只有被包含在這個區域內的地方才會被重繪,而不包含在區域內的其他區域系統將不會顯示.
定義
int SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw);
int SetWindowRgn(HRGN hRgn,BOOL bRedraw);
//在VC6.0基於對話框時候,該函式是這樣的,有兩個參數
參數
hWnd
[in] Handle to the window whose window region is to be set.
視窗的句柄
hRgn
[in] 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
[in] 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.
返回值
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.
說明
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 來獲取一個視窗的作用區域.
系統要求
Windows NT/2000/XP: 包括 Windows NT 3.51 在內的以後的版本.
Windows 95/98/Me: 包括 Windows 95 在內的以後的版本.
Header: Declared in Winuser.h; include Windows.h.
頭檔案在 Winuser.h 中聲明了這個函式,當然在 Windows.h 也有.
Library: Use User32.lib.
所屬的程式庫在 User32.lib