Resizing can be quite tedious -
I developed this resizing method for my Vcardz_i program https://forum.pellesc.de/index.php?topic=10191.0 which is resizing over 40 ontrols smoothly but that was hand coded control by control.
Now I've taken the concept and made it generic and 'automatic' suitable for a library and a header file or just two source files.
Attached are three small test files comparing the existing resizer and the new zsizer (temp name :) )
Test demos for the existing resizer and the developing one:
resizerP_move.exe -> existing resizer.lib and header (all set to 'move',except toolbar to resize)
resizerP_resize.exe -> existing resizer.lib and header (all set to 'resize')
Zsizer_new.exe -> every thing resizes. however for demo one can set pushbuttons to move only, using the 'Toggle Button Size' as a demo.
This new resizer allows smaller than original which the existing resizer does not - to emulate original use the 'toggle Min Size' button as a demo.
So far the new method adds 9k to the exe (no optimization used yet) compared to the existing resizer.
This is not complete nor perfect so I'm looking for any inputs -
Right now there are three commands, I've not made it into a library yet -
extern int Init_Resizer(HANDLE win, int n);
extern void Form_Resize(HANDLE hwinmain, int num_window);
extern void Free_zsizer(void);
It does not access the control properties for Resizable Dialogs as I don't know how to get those settings.
Using it just involves two files zsizer.h, zresizer.c or one file and a library
Nothing is subclassed, but might need to. The resize method and calculation method would still work within the existing resizer framework I believe. (it's only math ;D )
Not every control is happy re-sizing - I don't know if it will work with 'Owner draw' controls yet either.
John Z
One idea is to put resizable control id list under first id
and collect startsize to an array of rects.
When window size change, count new coefficient and size controls with it.
This method might work with DWM too.
That idea have been used with control / button grids, like games.
Hi Timo,
That is basically what it does. Given the 'main' window handle it enumerates the controls, stores base values and the 'main' window size. Then upon WM_Size it uses that data and the percent change of the 'main' form applied to each control position/size parameters for a 'move' command. Nothing is stored upon a resize event so little overhead, only stored when init_resizer is used under WM_INITDIALOG.
John Z
A simple example of resize difficulties and why it isn't so easy.
Here is a next iteration. The zsizer can now also resize Child dialogs.
Still using just the three functions -
Init_Resizer. Form_Resize, and Free_zsizer.
Click the 'Next Dialog' button to invoke the child dialog.
Child form also tests more control types being resized too.
John Z
sources moved to https://forum.pellesc.de/index.php?topic=11682.0
Hi John,
Keep up the nice work.
Hi Vortex,
Thanks - I think even though there are still some improvements to make I need to try to make a library now and test that usage.
I still need to test an owner-draw control too.
So far there are just three options that can be set/reset
1) do not shrink smaller than original size
2) do not resize std pushbuttons
3) do not resize the calendar
These can be set or reset anytime in the 'host' program.
John Z
Hi All,
Well here is the first pass library to try !
I've tested it making three different non-resizable programs, one was Hint_SA, into resizable dialogs, and they all were very successful. Just add three lines of code.
A library and a header file are in the attachment. Both are needed.
The header file includes instructions and tips on using the library.
One thing I do in vcardz_i is also optionally resize the Font with the dialogs.
Wondering if that would be useful in this Library?
Of course any success or especially failure feedback is very important to the completion of this resizing capability.
John Z
Removed attachment see https://forum.pellesc.de/index.php?topic=11682.0
Update:
Child of Child tested ok - no problem
Static controls class handling is updated ( I did not know a bitmap was a static control ) but fixed now.
Added simple method to inhibit resizing of individual controls providing a capability similar to the IDE settings in Resizable Dialogs, except not orientation specific.
New library for testing will be posted after some more clean up.
John Z
Update: Posted complete project with source at https://forum.pellesc.de/index.php?topic=11682.0
Closed projects are never of interest to me.
What is a 'closed' project? - this is still developing not closed.
If you are referring to just releasing the source code it is still developing and will be released soon, as I have done with almost everything I've posted.... buggy or incomplete code shouldn't be released IMO.
The library was posted to hopefully get some feedback on it other than just my own testing, opinions and thoughts.
Once released (soon) I hope some of the more professional developers can improve my amateur programming.
John Z
Update: Attached the project zip for building the library. Still to be done - make it
compatible with both ANSI and UNICODE - as posted it is not UNICODE aware.
Removed attachment see https://forum.pellesc.de/index.php?topic=11682.0
I was just a hobby programmer, but now retired and invalid.
But i bought a new HP laptop Windows 11, as it was so cheap, only 236 €
At another site
QuoteI bought an very cheap HP laptop with Intel® Core™ i3-N305 processor, so i can test code with it too.
It's maybe a matter of personal tast but like Timo, I support open source projects.
Every project, all 8, I have on SourceForge are open source, granted one or two might be a version or two behind due to computer replacements and getting the git or SVN access working again.
Every project on Pelles Forum has had the source included except Linecounter+. The code is such a tangle, works well, but spaghetti-fied it would not go over well :( Maybe I'll fix it for the next activity.
So I fully, and always support open source, but you open source something when it is finally finished IMO.
Anyway no worries, we are all in synch in reality I think.
The new sizer library code is posted can be used as a library or just include the sources directly.
Pelles Help file indicates he could be interested -
"The full source code for resizer.lib (and resizer64.lib) is included, so if you have a better idea how to handle this - just implement it (but it would be nice if you inform me, so I may include the changes in some future version).
"
So maybe he can use some ideas from this effort.
John Z
Hi John,
Please don't worry, everything is OK. Keep up the good work.
Proves, that generic resizer code might be difficult and needs lot of code.
Quote from: TimoVJL on November 24, 2025, 02:05:33 PMProves, that generic resizer code might be difficult and needs lot of code.
Indeed it does. Still working to improve it. Standard controls seem to be handled fairly well now, but still need more testing. Library is about 11k for now.
A simple "custom" control on the window works - just need to create it BEFORE calling Init_resize - that was my mistake it was after and I finally realized it.
Tested Owner-Draw of a simple text box it worked also!
The attachment is just a demo of the resizer in action. New code for the library will be posted soon. Open issues (but not blocks to using) are window glitching a bit if specified "LIMIT_SHRINK = TRUE" but trying to drag smaller for Main Dialog - just does not look nice. Second, still working on a maintain w/h ratio option, a nice to have IMO. Otherwise, to me, it is looking close to being completed.
John Z
Tester and library source code now posted under User Contributions -
https://forum.pellesc.de/index.php?topic=11682.0
Here is an early look at adding 'Auto Font Sizing' to the resizer library.
Still has some, maybe many, issues to work out but is a working preview. Just don't know how much interest there would be in having this feature. Is nice for visually impaired as full screen window has big text.
To test click the "Toggle Auto Font" button in lower right, then drag the window larger or smaller to see effects. Toggling 'Button resize' will also inhibit font resize for buttons since the button is not larger.
A few obvious issues: not working with custom control, Owner Draw sometimes double vision, restore of original is not yet implemented well. Not implemented globally yet so not for the child windows in this tester.
Just the tester at this point - no sources
John Z
Still just same three functions -sources moved to https://forum.pellesc.de/index.php?topic=11682.0