Re: SetMapMode
- From: "Mike Williams" <mikea@xxxxxxxxxxxxxxxxx>
- Date: Fri, 23 Mar 2007 13:25:36 -0000
"Steve" <sredmyer@xxxxxxxxxx> wrote in message news:1174648665.249890.144470@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
So given only the hWnd (which ofcoarse I know means I can
also get the hDc) how can I tell what the current ScaleMode
setting of a VB window is?
You can't. At least I can't think of a way of doing it, not if all you have is the hWnd. VB stores the current ScaleMode of each appropriate object somewhere of course (in its own working data area, wherever that may be) but I'm fairly sure there is nothing in the actual DC or window structure that will tell you what it is. As far as VB is concerned it uses a mapping mode of MM_TEXT (device pixels) for all of its windows (Forms, Picture Boxes, etc) regardless of the VB ScaleMode you are using and it performs the conversion from the VB ScaleMode units to device pixels at run time before drawing into the DC.
You can write code to temporarily change the API mapping mode of a VB window from pixels to anything you want if for some reason you wish to perform a drawing in a different mapping mode, as long as you make sure that you return the DC to its original condition before you allow VB itself to do anything with the window, but there is no way you can find out what the VB ScaleMode is simply by looking at the hWnd or at the DC. As far as VB is concerned it sets the initial mapping mode to pixels and it leaves it that way. When you use a native VB drawing method, VB performs runtime conversions from ScaleMode units to pixels when drawing into the DC.
If the code you are writing is designed to perform various operations with VB Forms or Controls then you would be better off passing your routines a reference to the Control itself rather than simply its window handle. Then you will be able to get at everything.
Mike
.
- Follow-Ups:
- Re: SetMapMode
- From: Steve
- Re: SetMapMode
- References:
- SetMapMode
- From: Steve
- Re: SetMapMode
- From: Mike Williams
- Re: SetMapMode
- From: Steve
- SetMapMode
- Prev by Date: Re: SetMapMode
- Next by Date: Re: lock combo-box for manual change
- Previous by thread: Re: SetMapMode
- Next by thread: Re: SetMapMode
- Index(es):
Relevant Pages
|
Loading