NO

Author Topic: fillout a triangel with a colour  (Read 3951 times)

jasch212

  • Guest
fillout a triangel with a colour
« on: November 23, 2008, 04:52:29 PM »
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

  • Guest
Re: fillout a triangel with a colour
« Reply #1 on: November 23, 2008, 08:20:51 PM »
Try changing it to something like this.

Code: [Select]
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

  • Guest
Re: fillout a triangel with a colour
« Reply #2 on: November 24, 2008, 07:31:46 PM »
hi Synfire,
thank you for the fast answer.
it work's very fine! :)

jasch212