使用RGN class, GDI
從WIN32 API 書上看到的
特別注意
CreateRectRgn(x1,y1,x2,y2);
是左上與右下的座標點
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__fastcall TForm_bingoup::TForm_B(TComponent* Owner) | |
: TForm(Owner) | |
{ | |
//先取得視窗風格性質 | |
DWORD dwStyle =::GetWindowLong(Handle,GWL_STYLE); | |
//去除視窗的標題列性質 | |
dwStyle &= ~WS_CAPTION; | |
//再將無標題列的風格重設回視窗 | |
::SetWindowLong(Handle,GWL_STYLE,dwStyle); | |
RECT r; | |
//取得指定視窗範圍位置 | |
::GetClientRect(Handle,&r); | |
//創造兩個方形位置與範圍 | |
HRGN hRgn1=::CreateRectRgn(120,7,432,388); | |
HRGN hRgn2=::CreateRectRgn(8,390,553,578); | |
//再結合兩個方形位置與範圍 | |
::CombineRgn(hRgn1,hRgn1,hRgn2,RGN_OR); | |
//設回指定視窗的顯示範圍 | |
::SetWindowRgn(Handle,hRgn1,TRUE); | |
::SetProp(Handle,"region",hRgn1); | |
} |
再去跑圖書館一次
這本書有機會想買:Windows Graphics Programming: Win32 GDI and DirectDraw
雖然說MSDN老師說會用最重要,但是光看他的敘述實在寫不出來,我需要實際例子,就把它當作文法書上的文法,可供快速查閱,但例句要自己找
MSDN-CreateRectRgn function
資料來源
[1]:C++ builder & windows API範例辭典
沒有留言:
張貼留言