Help me to draw line and rectangle.

Login to reply to this topic.
Fri, 2008-03-07 09:50
Joined: 2007-08-29
Forum posts: 128

Hi,

I want to draw line and rectangle in my application. I am getting error undefined identifier 'gc'. I know undefined identifier means it is not defined.but it is defined in view class.
My code is here for drawing line and rectangle..

case EGUICmdLine:
{ // to draw Line
TPoint startPoint(50,50);
TPoint endPoint(590,190);
gc.DrawLine(startPoint,endPoint);
break;
}

case EGUICmdRect:
{

// To draw rectangle
gc.SetBrushColor( TRgb(255,0,0));
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
TRect drawRect(15,15,50,50);
gc.DrawRect(drawRect);
}
In my view class I have this line. CWindowGc& gc = SystemGc();

Please tell me which mistake I am doing. I need help so please any one answer me or correct my code so I can use.
I am waiting for valuable response. Puzzled


Thanks & Regards
Ram

Symbian OS 9.1,S60 3rd edition MR,and CodeWarrior 3.1


Fri, 2008-03-07 09:59
Joined: 2004-11-29
Forum posts: 1134
Re: Help me to draw line and rectangle.

"In my view class I have this line. CWindowGc& gc = SystemGc();"

What do you mean by that?

If it is in the same function, then it should work.
If it is in another function, then of course it will not work.

Mon, 2008-03-10 05:54
Joined: 2007-08-29
Forum posts: 128
Re: Help me to draw line and rectangle.

Hi Alh,

thank you for your reply.

Now i get my mistake and solve my problem with your help. Now I am able to draw line and rectangle.


Thanks & Regards
Ram

Symbian OS 9.1,S60 3rd edition MR,and CodeWarrior 3.1

Mon, 2008-03-10 11:39
Joined: 2007-08-29
Forum posts: 128
Re: Help me to draw line and rectangle.

Hi Alh,

I have drawing application in which I am able to draw point,line, polyline, polygon,rectangle, and round rectangle. Now I want to draw this continously this. How I will do that. Please give me some hints aur idea.I am waiting for reply.

Thanks in advance.


Thanks & Regards
Ram

Symbian OS 9.1,S60 3rd edition MR,and CodeWarrior 3.1

  • Login to reply to this topic.