任意形状,总可以用一个多边形(或多个多边形)来描述吧。那么用
HRGN CreatePolygonRgn(CONST POINT *lppt, int cPoints, int fnPolyFillMode);
或
HRGN CreatePolyPolygonRgn(CONST POINT *lppt, CONST INT *lpPolyCounts,
int nCount, int fnPolyFillMode);
来生成区域,再用SetWindowRgn就可以了。
很多api函数可以做到的,给你两个参考参考:)
设置窗体的形状
int SetWindowRgn(
HWND hWnd, // handle to window
HRGN hRgn, // handle to region
BOOL bRedraw // window redraw option
);
//生成椭圆形状
HRGN CreateEllipticRgn(
int nLeftRect, // x-coord of upper-left corner of rectangle
int nTopRect, // y-coord of upper-left corner of rectangle
int nRightRect, // x-coord of lower-right corner of rectangle
int nBottomRect // y-coord of lower-right corner of rectangle
);