CreatePolyRgn
-
What about this function??? I would like to create a filled triangle. But i can't call the function Create PolyRgn.
-
What about this function??? I would like to create a filled triangle. But i can't call the function Create PolyRgn.
Hi Rassul Yunussov, To draw a polygon. First, you must create an array of vertices for your polygon. And then call the Polygon function with two parameters: One is the array, and one is the number of vertices you want to draw. Here is the example to draw a filled triangle using Polygon function:
CBrush brushRed(RGB(255, 0, 0)); CBrush* pOriginBrush= pDC->SelectObject(&brushRed); CPoint pts[3]; pts[0].x = 1; pts[0].y = 1; pts[1].x = 1; pts[1].y = 100; pts[2].x = 100; pts[2].y = 100; pDC->Polygon(pts, 3); pDC->SelectObject(pOriginBrush);
Regards, -Kien Bui