Getting width and height from CDC
Carsten Schwartz -- csn@dhi.dk
Friday, November 08, 1996
Environment: Windows NT 4.0, VC++ 4.2b
How do i get the width and the height of the viewport
of a CDC in pixels without calling GetParent, GetClientRect
and other CWnd functions ?
Normally I would used code like this
CWnd * container;
RECT client_rect;
int width, height;
container = (pDC->GetWindow())->GetParent();
container->GetClientRect(&client_rect);
width = (client_rect.right - client_rect.left);
height = (client_rect.bottom - client_rect.top);
and GetViewportExt only gives mee 1 X 1 (cx X cy)....
_____________________________________________________
Carsten Schwartz Email : csn@dhi.dk
Software Engineer www : http://www.dhi.dk
Danish Hydraulic Institute Tel. : +45 45 76 95 55
Agern Alle 5 Fax. : +45 45 76 25 67
2970 Horsholm
Denmark
And they shall know no fear...
_____________________________________________________
Alexander Grigoriev -- alegr@aha.ru
Saturday, November 09, 1996
Window viewport does not mean "visible area size". Viewport extents to
window extents ratio just defines a coefficient to translate logical
coordinates to physical. Use GetClipBox() to obtain a rectangle to draw in.
----------
> From: Carsten Schwartz
> To: mfc-l@netcom.com
> Subject: Getting width and height from CDC
> Date: 8 ОПСВТС 1996 З. 10:07
>
>
> Environment: Windows NT 4.0, VC++ 4.2b
>
> How do i get the width and the height of the viewport
> of a CDC in pixels without calling GetParent, GetClientRect
> and other CWnd functions ?
>
> Normally I would used code like this
>
> CWnd * container;
> RECT client_rect;
> int width, height;
>
> container = (pDC->GetWindow())->GetParent();
> container->GetClientRect(&client_rect);
> width = (client_rect.right - client_rect.left);
> height = (client_rect.bottom - client_rect.top);
>
> and GetViewportExt only gives mee 1 X 1 (cx X cy)....
| Вернуться в корень Архива
|