>>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.
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.
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.
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.
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".
Forum posts: 56
your question is bit confusing . can you please explain it with examples.?
Forum posts: 285
>>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
Forum posts: 28
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
Forum posts: 1058
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
Forum posts: 28
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
Forum posts: 1058
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
Forum posts: 28
Hi In Draw() and container class.
Regards
kashif
Forum posts: 1058
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
Forum posts: 28
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
Forum posts: 1058
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
Forum posts: 174
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".
http://ptrmobile.blogspot.com/