Archived

This topic is now archived and is closed to further replies.

Thrump

Getting DC height and width

Recommended Posts

Thrump    169
How do you get the height and width of an arbitrary DC? GetDeviceCaps seemed the way to go, but it only seems to work on the screen.

Share this post


Link to post
Share on other sites
v71    100
void OglView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
CClientDC dc( this );
CRect rect;
GetClientRect( rect );
CDC dcMem;

dcMem.CreateCompatibleDC( & dc );

// grab anything you like here, now dcMen contains
// a copy of the current device context for the
// view you have called the onsize message

dcMem.DeleteDC( );

Mx = ( float )( rect.right - rect.left ) ;
My = ( float )( rect.bottom - rect.top ) ;



}



Share this post


Link to post
Share on other sites