Regards TRect

Login to reply to this topic.
Mon, 2008-03-17 13:51
Joined: 2007-02-13
Forum posts: 28

Hi i want to know how we find actual size of TRect, i mean we consider screen as a rectange on the s
the screen of emulator . any one dscribe this.

Regards
kashif


Mon, 2008-03-17 14:35
Joined: 2005-12-07
Forum posts: 56
Re: Regards TRect

your question is bit confusing . can you please explain it with examples.?

Tue, 2008-03-18 07:00
Joined: 2004-05-21
Forum posts: 285
Re: Regards TRect

>>i want to know how we find actual size of TRect
TRect itself is size. What do you mean by that?

>>i mean we consider screen as a rectange on the sthe screen of emulator
If you want to get the screen size then check out CWsScreenDevice::GetScreenModeSizeAndRotation api.

Cheers,
Sri

Tue, 2008-03-18 08:35
Joined: 2007-02-13
Forum posts: 28
Re: Regards TRect

Hi Manish suppose i am use TRect like that

TRect rect = Rect();
rect.Shrink( 10, 10 );

so tell me in this case what will be the value of rect.

Regards
kashif

Tue, 2008-03-18 08:37
Joined: 2005-11-20
Forum posts: 1058
Re: Regards TRect

It depends *where* you write that code, and which object is "this" i.e. the Rect() method of which object is called by executing your two lines of code.


René Brunner

Tue, 2008-03-18 09:22
Joined: 2007-02-13
Forum posts: 28
Re: Regards TRect

Hi i am using this for draw the Ellipse , whole code for this.

TRect rect = Rect();
rect.Shrink( 10, 10 );
gc.SetPenStyle( CGraphicsContext :: ESolidPen );
gc.SetPenColor( KRgbBlack );
gc.SetPenSize( TSize( 5, 5 ) );
gc.SetBrushStyle( CGraphicsContext :: ESolidBrush );
gc.SetBrushColor( KRgbYellow );
gc.DrawEllipse( rect );

Regards
kashif

Tue, 2008-03-18 09:48
Joined: 2005-11-20
Forum posts: 1058
Re: Regards TRect

Sorry, but you still don't say *where* you have that code: In which method of which class to you embedd the code that you list?


René Brunner

Tue, 2008-03-18 09:59
Joined: 2007-02-13
Forum posts: 28
Re: Regards TRect

Hi In Draw() and container class.

Regards
kashif

Tue, 2008-03-18 10:06
Joined: 2005-11-20
Forum posts: 1058
Re: Regards TRect

Ok, then Rect() will give you the net size and position of the container's window. If you shring this rectangle by 10,10 you will draw into a rectangle that leaves a room of 10 pixels free on all four sides of the container window.


René Brunner

Tue, 2008-03-18 10:11
Joined: 2007-02-13
Forum posts: 28
Re: Regards TRect

hi But pls tell me before shrink what will be the rect value, imean

TRect rect = Rect();

here what will be co-ordinate of rect.

Regards
kashif

Tue, 2008-03-18 10:25
Joined: 2005-11-20
Forum posts: 1058
Re: Regards TRect

I am often unsure myself about such rectangle positions, and if I need to be sure I just take the whole thing into the debugger and have a direct look. Very simple (if you know how to debug, which you should.)

In this case I would say probably the coordinates are screen-absolute, i.e. the TRect gives the position of the corner of the container's window relative to the whole screen/display.


René Brunner

Sat, 2008-03-22 13:54
Joined: 2005-06-09
Forum posts: 174
Re: Regards TRect

mdkashif: If you accidentally forgot to read the manual, and you're asking if there's an API to query a rect for its size and position, the first answer would be "read the manual", and if you still can't find it, the answer is "the member variables iTl and iBr are public".


  • Login to reply to this topic.