複製鏈接
請複製以下鏈接發送給好友

CreateRoundRectRgn

鎖定
CreateRoundRectRgn函數創建的一個帶圓角的矩形區域。
中文名
CreateRoundRectRgn
外文名
HRGN CreateRoundRectRgn
性    質
帶圓角的矩形區域
方    法
要用DeleteObject函數刪除該區域

目錄

CreateRoundRectRgnVC聲明

HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse);

CreateRoundRectRgn參數

nLeftRect
[in] 指定了x座標的左上角區域邏輯單位。
nTopRect
[in] 指定了y座標的左上角區域邏輯單位。
nRightRect
[in] 指定了x座標的右下角區域邏輯單位。
nBottomRect
[in] 指定了y座標的右下角區域邏輯單位。
nWidthEllipse
[in] 指定創建圓角的寬度邏輯單位。
nHeightEllipse
[in] 指定創建圓角的高度邏輯單位。

CreateRoundRectRgn返回值

如果函數成功,返回該區域的句柄。
如果函數失敗,返回NULL。
在Windows NT/2000/XP中: 取得錯誤信息, 調用GetLastError。

CreateRoundRectRgn説明

Region coordinates are represented as 27-bit signed integers.
系統要求 :
Windows NT/2000/XP: 包括 Windows NT 3.1 和更晚的版本。
Windows 95/98/Me: 包括 Windows 95 和更晚的版本。
頭文件: 在 Wingdi.h 中定義; 在 Windows.h 中包括。
庫文件: 使用 Gdi32.lib.
[1] 

CreateRoundRectRgnVB聲明

Declare Function CreateRoundRectRgn Lib "gdi32" Alias "CreateRoundRectRgn" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long

CreateRoundRectRgn説明

創建一個圓角矩形,該矩形由X1,Y1-X2,Y2確定,並由X3,Y3確定的橢圓描述圓角弧度 返回值 Long,執行成功則為區域句柄,失敗則為0

CreateRoundRectRgn參數表

X1,Y1 Long,矩形左上角的X,Y座標
X2,Y2 Long,矩形右下角的X,Y座標
X3 Long,圓角橢圓的寬。其範圍從0(沒有圓角)到矩形寬(全圓)
Y3 Long,圓角橢圓的高。其範圍從0(沒有圓角)到矩形高(全圓)

CreateRoundRectRgn註解

不用時一定要用DeleteObject函數刪除該區域
用該函數創建的區域與用RoundRect API函數畫的圓角矩形不完全相同,因為本矩形的右邊和下邊不包括在區域之內
參考資料