fillout a triangel with a colour

Started by jasch212, November 23, 2008, 04:52:29 PM

Previous topic - Next topic

jasch212

hi,
how can i fill the traingel with a color?

...
// Create a pen, one pixel, bright red.
  HPEN hpen = CreatePen(PS_SOLID, 1, RGB(255,0,0));
// Select the pen into the 'Device context' and remember the previous pen.
  HPEN hpenSave = SelectObject(ps.hdc, hpen);
// Array of points to 'connect'.
  POINT apt[] = {
  { 20,20 },
  { 50,20 },
  { 50,50 },
  { 20,20 }
  };

// Draw lines between the points in the 'apt' array.
  Polyline(ps.hdc, apt, sizeof(apt) / sizeof(apt[0]));

thanks for answers.

Synfire

Try changing it to something like this.

HBRUSH hBrush = CreateSolidBrush( RGB(255,0,0) );
SelectObject( ps.hdc, hBrush );
POINT apt[] = {
  { 20,20 },
  { 50,20 },
  { 50,50 }
};
Polygon( ps.hdc, apt, 3 );


Hope that works..  ???

jasch212

hi Synfire,
thank you for the fast answer.
it work's very fine! :)

jasch212