首页 > 代码库 > 椭圆形的窗口

椭圆形的窗口

//  新视窗类

with wc do begin

    style := CS_VREDRAW or CS_HREDRAW;
    lpfnWndProc := @GdiProc1;
    cbClsExtra := 0;
    cbWndExtra := 0;
    hCursor := LoadCursor(0, IDC_ARROW);//  ;
    hbrBackground := GetSysColorBrush( windows.COLOR_INFOBK );//HBRUSH(GetStockObject(windows.GRAY_BRUSH));
    hInstance := HInstance;
    lpszMenuName := nil;
    lpszClassName := szAppName;
    //hIcon := ficon1;
    end;
windows.RegisterClass(wc);


//  建窗口
Main := CreateWindowExA(WS_EX_OVERLAPPEDWINDOW, szAppName, szAppName, WS_VISIBLE or WS_SYSMENU  or WS_SizeBox or WS_GROUP,
                        Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), 800, 600, HWND_DESKTOP, 0, 0, nil);

//  获取窗体尺寸

GetWindowRect(Main, re1);

main_DC := GetWindowDC(Main);

rg1 := CreateEllipticRgnIndirect( re1 );                                                 // 创建一个内切于特定矩形的椭圆区域
FillRect(main_DC, re1, 15 + 5 );
Rectangle(main_DC, re1.Left, re1.Top, re1.Right, re1.Bottom);

SetWindowRgn(Main, rg1, true);                                                          // 用SetWindowRgn实现程序窗口变形


注:全部源程序下载,请访问下载频道-我的资源。