M
M
Mykola Franchuk2016-01-31 06:26:35
C++ / C#
Mykola Franchuk, 2016-01-31 06:26:35

How to change the design of the window in the form while the program is running?

Hello!
When writing at least slightly complex applications, it becomes necessary to completely change the design of the form. How to do it right? Is it necessary to close the current form and immediately call a new one with a different design, or is it more correct to make all form elements invisible by drawing new ones on top? Or is there some other better way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
VZVZ, 2016-01-31
@kuzia_bRatok

> A vivid example of what is desired is the installer of any application (Installation Wizard)
Well, I personally somehow did not have to make Wizards, but I will say the following:
1) If the interface is not quite dynamic, but still template, then it would be more convenient in advance ( in WYSIWYG) make many forms for each wizard screen and just change them.
But specifically changing forms (windows) is not a good idea, quietly hiding one window and showing another is difficult (it looks ugly), and there are still nuances, these are OS features.
I would look towards composite controls (they are also user controls), I would make each screen a separate user control, and all of them on one form (like Panel). At the same time, I would edit them - through separate files, as if they were separate forms.
And what to show, what to hide - it's up to either the screens or the container form. Rather, the second one, each screen would return a value according to the ShowDialog principle, return it to the form, and it would already decide.
2) In Windows for wizards there are ready-made tools - Property Sheets. Yes, it's WinAPI, Yes, it's that hemorrhagic. However, I would definitely check them out. Maybe it's worth writing a convenient wrapper for them under .NET. Or at least adopt some interesting solutions from them - and embody them in your wizards, which then will really become the most wizard-like wizards in the world.

A
Ai Lab, 2016-01-31
@vpuhoff

Depending on what exactly is meant by "design". Ideally, all draw calls to controls "know" the current design, and when it changes, they simply draw the "new" design. In this case, you don’t need to close or reload anything, at best, it’s enough to Refresh the windows after changing the “current” to “new”

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question