显示不规则窗体
思路:
从图片中读取路径信息(实际上是点,每一个点的信息),将这些点存为一个路径,最后为窗体设置路径信息SetWindowRgn
关键API:
(1)CreatePolygonRgn
(2)SetWindowRgn
在分析图片路径的过程中需要用到的API:
(1)CreateRectRgn
(2)CombineRgn
GDI+实例代码:
VOID Example_AddPolygon(HDC hdc)
{
Graphics graphics(hdc);
Point pts[] = {Point(20, 20),
Point(120, 20),
Point(120, 70)};
GraphicsPath path;
path.AddPolygon(pts, 3);
// Draw the path.
Pen pen(Color(255, 255, 0, 0));
graphics.DrawPath(&pen, &path);
}
参考信息:
C++ Builder 精彩编程实例锦集,实例006
http://msdn.microsoft.com/en-us/library/ms535593(VS.85).aspx
CreatePolygonRgn
SetWindowRgn


Point pts[]
浙公网安备 33010602011771号