Click here to Skip to main content
Sign Up to vote bad
good
Dear all I have a problem. I was created a triangle using LineTo and MoveTo methods. Now I am trying to fill that triangle by solid color using FillRgn of CDC class. But WinCE does not support this method. Can anybody tell me the other way to fill that triangle? Here is my code:
for(unsigned short uCntr = 0; uCntr<=tRcsStructure.tSysSetting.ucMaxStationNumbers-1; uCntr++)
{
	unsigned short x_pos = 45;
	m_PenColor.CreatePen(PS_SOLID,2,m_dwColour[uCntr]);
	pDC.SelectObject(m_PenColor);pDC.MoveTo(63,(135 + (uCntr * x_pos)));
        pDC.LineTo(96,(135 + (uCntr * x_pos)));
        pDC.MoveTo(63,(117 + (uCntr * x_pos)));
        pDC.LineTo(63,(135 + (uCntr * x_pos)));
        pDC.MoveTo(63,(117 + (uCntr * x_pos)));
        pDC.LineTo(96,(135 + (uCntr * x_pos)));
}
 
Currently I am using eVC 4.0.
Posted 2 Jun '12 - 2:02
Edited 4 Jun '12 - 8:18


1 solution

I have no experience in WinCE, but I would use CDC::Polygon, which automatically fills the polygon with the current brush. So create a brush with the same color as your solid pen, select it into the DC and then draw a polygon with the three points of your triangle. (Of course you know that a triangle is a special case of a polygon.)
  Permalink  
Comments
vaibhavj_navdurga - 2 Jun '12 - 8:44
Shall we draw a triangle using polygon method?
nv3 - 2 Jun '12 - 9:29
Exactly.
vaibhavj_navdurga - 4 Jun '12 - 1:48
Thank you for your help. My problem is solved using Polygon method.
vaibhavj_navdurga - 5 Jun '12 - 3:26
Is this possible to give the border color to the polygon? If yes, then how? Please help me I am trying the same.
nv3 - 5 Jun '12 - 3:31
Of course, your current pen determines the border color.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 425
1 OriginalGriff 330
2 Arun Vasu 253
3 Zoltán Zörgő 194
4 CPallini 173
0 Sergey Alexandrovich Kryukov 10,105
1 OriginalGriff 7,739
2 CPallini 4,181
3 Rohan Leuva 3,482
4 Maciej Los 2,999


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 4 Jun 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid