15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Dialogs that don't resize with small/large fonts

Crucial Software -- crucial@ix.netcom.com
Monday, May 06, 1996

MSVC++ 4.1; targetting NT 4.0 and Win 95

I have constructed a dialog box that has no text in it... it is all
graphics (custom painted graphics and bitmap buttons).  I have designed
the dialog box in small font mode.

Because of the nature of the dialog (ie, no static text etc), I do NOT
want the dialog box to resize when viewed in large font mode.  Is there
some way -- beyond storing the pixel sizes of everything in an array in
my program and resizing by hand -- that I can tell Windows NOT to resize
the dialog for the larger font?

Brad

--
Brad Wilson, Crucial Software     crucial@ix.netcom.com    +1 (810) 620-9803
Custom software engineering services for Microsoft Windows NT and Windows 95

   "The struggle of history is between those who can and those who don't"




Frederic Steppe -- FredericS@msn.com
Thursday, May 09, 1996

[Mini-digest: 3 responses]

> MSVC++ 4.1; targetting NT 4.0 and Win 95
>
>Because of the nature of the dialog (ie, no static text etc), I do NOT
>want the dialog box to resize when viewed in large font mode.  Is there
>some way -- beyond storing the pixel sizes of everything in an array in
>my program and resizing by hand -- that I can tell Windows NOT to resize
>the dialog for the larger font?

I don't think you can tell Windows not to resize the dialog, but you certainly 
can resize it yourself before it is displayed.  Check GetDialogBaseUnits() and 
MapDialogRect() functions if you have to deal with dialog base units.

Hope this will help.

Frederic Steppe (frederics@msn.com)
-----From: Arshad Hussain 

If you have created the dialog from the reource editor, that could be the problem. 
Because, that's based on dialog units and not pixels.

Try setting the size of just the dialog (MoveWindow() or SetWindowPos()), in 
OnInitDialog(), or any appropriate place.

Arshad
-- 
Mohammed Arshad Hussain       arshad@sierranet.net
The ImagiNation Network, Inc.
-----From: mikeblas@interserv.com

On Mon, 6 May 1996, Brad Wilson/Crucial Software  
wrote:
>MSVC++ 4.1; targetting NT 4.0 and Win 95

Thanks.

>I have constructed a dialog box that has no text in it... it is all
>graphics (custom painted graphics and bitmap buttons).  I have designed
>the dialog box in small font mode.

>Because of the nature of the dialog (ie, no static text etc), I do NOT
>want the dialog box to resize when viewed in large font mode.  Is there
>some way -- beyond storing the pixel sizes of everything in an array in
>my program and resizing by hand -- that I can tell Windows NOT to resize
>the dialog for the larger font?

You don't have to store an array, but you will need to resize the dialog and 
its controls after creating it.  You can figure out what sizing ratio you 
need to use by reading up on GetDialogUnits().  There's a ratio between 
pixels and the font your box uses; you just need to multiply by enough to 
adjust that ratio.

.B ekiM
--
Is it just me, or is an NEC 17-inch monitor really 12% undersize?



Rick Esterling -- rick@eco.twg.com
Monday, May 13, 1996

> MSVC++ 4.1; targetting NT 4.0 and Win 95

> >Because of the nature of the dialog (ie, no static text etc), I do NOT
> >want the dialog box to resize when viewed in large font mode.  Is there
> >some way -- beyond storing the pixel sizes of everything in an array in
> >my program and resizing by hand -- that I can tell Windows NOT to resize
> >the dialog for the larger font?

> I don't think you can tell Windows not to resize the dialog, but you
> certainly can resize it yourself before it is displayed.  Check
> GetDialogBaseUnits() and MapDialogRect() functions if you have to deal
> with dialog base units.

[...]

> You don't have to store an array, but you will need to resize the dialog and 
> its controls after creating it.  You can figure out what sizing ratio you 
> need to use by reading up on GetDialogUnits().  There's a ratio between 
> pixels and the font your box uses; you just need to multiply by enough to 
> adjust that ratio.

There is no function called GetDialogUnits( ).  Assuming you were
referring to GetDialogBaseUnits( ), then you're correct that the
documentation for that function will be helpful, but the function itself
will not.

There's a relevant MSDN article titled, "The Human Factor: Sizing Things
Up", which originally appeared in the Nov/Dec 1995 issue of MS Developer
Network News (and is still on the MSDN CDs).  In Win95 (and presumably NT
4.0), you'll need to call SystemParametersInfo( ) / GetTextMetrics( )
instead of GetDialogBaseUnits( ) since the latter only gets you the
metrics of the font named "System" rather than the font typically used in
a Win95 dialog box.  Obviously, in Win95 the System font may have nothing
whatsoever to do with the runtime sizing of your dialog, so
GetDialogBaseUnits( ) won't really tell you anything (except the
documentation for the function does show you the correct formula to use
with the data you get back from SystemParamteresInfo( ) and
GetTextMetrics( )).

Good luck,

------------------------------------------------------------------------

Richard A. Esterling            Attachmate Internet Products Group (IPG)
Senior Software Engineer        McLean, VA                  703-847-4500
http://widget.eco.twg.com:1080  http://www.twg.com




| Вернуться в корень Архива |