News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Simple resizer Library

Started by John Z, November 30, 2025, 12:36:30 PM

Previous topic - Next topic

John Z

A simple to use resizer library -

Use both zresizer.c and zsizer.h when building the library

Use ResizerZ.lib and zsizerlib.h in the application, zsizer.h 
is not needed when implementing resizing using the library.

Use all three files if implementing as source code and not as library.
Entire project zip file is attached.
--------------
Basic Features:
For the most part resizing a Dialog resizes and moves everything
based on the Dialog window size changes.

Individual controls can be prevented from changing size but not
from moving. 

Two controls (pushbuttons like "ok") and Calendar can be globally
prevented from resizing by setting BUTTON_RESIZE, and/or
CALENDAR_RESIZE respectively to FALSE. In this case there is no
need to identify every control of these types to not resize.

Dialogs can be restricted to no smaller than original design by
setting LIMIT_SHRINK = TRUE. Works but a bit glitchy when trying to
drag smaller than original...

All settings are done initially in ResizerZ.lib, but the programs
can manipulate these as well since they are global in zsizerlib.h.

Only three functions are needed.  These are added to each Dialog to be resized
Init_Resizer(HANDLE hwndDlg,int n);// last line in WM_INITDIALOG
Form_Resize(HANDLE hwndDlg, int n);// in WM_SIZE
Free_zsizer(int n);                // in WM_CLOSE

The library the version number can be obtained by
What_Version(); //returns a double which is the lib version

Easy to implement worked well in test cases testing more than 20 of the control types
If bugs are fixed, or improvements are made it would be nice to post the revision.

The Zsizer_tester.zip is a demo program (with sources) showing implementation of the library for a main dialog, a child and a child of a child.  Many controls are shown but the program does not do anything in particular, and is not an example of good programming practices -  ;) 

More detailed information is within zsizerlib.h

John Z



Robert

Hi John Z:

Thank you. The demo will be very helpful for those of us trying to understand how the library is implemented.

For me, the demo is absolutely essential. Without it, I couldn't even begin.