-
January 9th, 2004, 07:24 AM
#1
GetClipBox & GetBoundsRect ?
hi all,
i need the width and height of the CDC object so i tried this
CRect rc;
CString str;
m_MemDC.SetBoundsRect(&rc,DCB_SET|DCB_ENABLE);
for ( int i = 0 ; i < 500 ; i+=10 )
{
str.Format("done -%d",i);
m_MemDC.TextOut(0,i,str);
}
m_MemDC.GetBoundsRect(&rc,DCB_ACCUMULATE|DCB_ENABLE );
m_MemDC.GetClipBox(&rc);
i tried to User GetBoundsRect and GetClipBox of CDC but was not able to get the actual
width and height of the CDC.
-GetClipBox get only the ctrl width and height
-GetBoundsREct gets the width and height only if it is less than ctrl width
is there some way to get or it is not possible at all
eagerly waiting for a solution
thanks
rajeev
-
January 9th, 2004, 09:19 AM
#2
The width and the height you can get from the window. Obviously somewhere you wrote something like HDC hDC = ::GetDC(m_hWnd);
Good luck
-
January 12th, 2004, 12:29 AM
#3
hi Caprice,
thanks for the reply
Here i am talking about the MemoryDc area ( rectangle )not the window rectangle.
thanks ahead
rajeev
-
January 12th, 2004, 02:03 AM
#4
GetBoundsRect() and GetClipBox() both deal with the temporary clipping region, which changes as parts of the DC get validated or invalidated. A DC has no "size" as such, as it is a virtual drawing context which is either assigned to a physical device (like screen or printer), or an offscreen bitmap (in the case of a memory DC). In the first case, the "bounds" of the DC are the physical bounds of the device or the window bounds. In the second case, the "size" of the DC is determined by the size of the bitmap you select into it to do the offscreen drawing.
-
January 12th, 2004, 03:27 AM
#5
hi gstercken,
thanks for the reply.
I Got it.
cheers
rajs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|