Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows C++ dialog resizer class

I'm looking for a really good dialog resizer class that will stretch and shrink individual items as needed as the screen is resized. Stephan Keil has a good one (DlgResizeHelper) which basically resizes everything by a set ratio, but I'm looking for something smarter.

For example:

  • Icons should not resize

  • Single-line text boxes should not be stretched vertically

  • Buttons should probably stay the same size

Basically I'm looking for something to look at all of the controls, figure out that a static text field is related to a control next/below it and anchor the two together, and resize large controls in a 'smart' way so it looks good.

Are there such frameworks out there? I've been working on one but something ready-made would probably be better.

FOLLOW UP: I'm looking at the suggested solutions. Many of them require you to go in an anchor each control on the dialog. I'm looking for something smart that will figure out what the anchors ought to be, with the ability to manually anchor if the guesses are wrong. Seems like it should be possible -- most humans would agree a static text field next to an edit field should be anchored together. Guess I'm almost looking for a little AI here :)

like image 414
DougN Avatar asked Sep 27 '08 22:09

DougN


People also ask

How to resize all dialog controls at once?

We use CResize class from CodeGuru to resize all controls automatically. You tell how you want each control to be resized and it does the job for you. The resize paradigm is to specify how much each side of a control will move when the dialog is resized. Very handy when you have a large number of dialog controls. Show activity on this post.

What is csizingdialog and how to use it?

The movement of controls in a dialog can be simply regarded as the movement of the four borders of controls, which make the whole control resize and reposition in a dialog. The class CSizingDialog is just based on such a simple fact and is encapsulated for better use. Let's start with how to use the class. The details will be discussed later:

How to change the base class of a dialog class?

Change the base class of your dialog class (for example CYourDlg) from CDialog to baseCYourDialog where CDialog occurs as the base class of CYourDlg. Add the following code to header file YourDlg.h:

How do I resize a dialog box in AutoCAD?

program and resize the dialog by dragging it’s border, and by using the maximize and restore buttons. The dialog resizes as a typical window should. But the CEditBox control always remains the same size and in a fixed position. Let’s fix this behavior to match that of the dialog’s.


2 Answers

You can use wxWidgets. It completely replaces MFC, is multi-platform, and gives you a layout-based dialog mechanism.

like image 98
Rui Curado Avatar answered Oct 01 '22 21:10

Rui Curado


I use ResizableLib (also does PropertySheets and Pages) off codeproject, IIRC. You set anchor points that determine how the dialog and controls resize or move as the dialog moves.

You can set up to 2 anchors per control, (left, right) so you can move them as the dialog moves, or resize them as it moves. Its very easy to understand, if difficult to get perfectly right :)

like image 32
gbjbaanb Avatar answered Oct 01 '22 23:10

gbjbaanb