Resolved Getting place for a panel

Gloops

Well-known member
Joined
Jun 30, 2022
Messages
137
Programming Experience
10+
Hello everybody,

I am going to describe a situation that I presume several of you have already met.

I added controls on a form that is somewhat heavy as a GUI, so there is not that much place available left.
Then, I realized that the controls I added would me much better on a panel, either visually or from a functional point of view.

My first attempt was to cut the controls to the clipboard, create a panel, and then Ctrl V to paste the controls from the clipboard to the panel.

It appears this was not so efficient as that, and I had to create manually several of the controls again.

So, I try and imagine another procedure to attempt, I should like to know what you think of it.

I consider creating a new form, to save the controls on it, in order to, at least, being able to find them again (if possible, with the code attached). As the clipboard did not appear to be a sufficient saving place.

When trying to apply that, I ran into a problem that perhaps would justify another thread here : Visual Studio 2019 Community Edition was unable to create a form. I remember having that problem one day, I was said to uninstall and reinstall the workload of "C# and VB.Net" from Visual Studio.

It did not appear to give a satisfying results, do you think I should do it again ?
Perhaps doing an update between both operations was a bad idea ?

I do not know whether this can have an interest : I work on a disk image of last year (this is why I am not working on Visual Studio 2022), for SQL Server ran into a problem to be reinstalled, and a lock prevented from finalizing the installation. At least, there is no more lock, although the installation program complains that it misses a folder in its installation support.
 
Last edited:
Solution
The Document Outline window may also be used for this, at least you can drag a control into another container and keep existing event handlers, then fine tune placement etc in designer afterwards.
Just make the form bigger, add the Panel anywhere in the empty space, select all the controls you want to move, drag them onto the Panel as a group, position the Panel where you want it and then reset the size of the form. It's important that you drag and drop the controls because if you cut and paste then you will lose any connections to event handlers you had.
 
Hello,
Thank you for your quick answer.
Provided the form would have been just a little less "heavy", I should have done that.
But, and this is where having mentioned the disk image can have an interest, I have as screen resolution (and it is probably not the correct word) that is lower than what I was used to. I should like to find somebody to discuss this question with, each time you change the fonts in
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]

the Windows user interface globally displays more little, except the fonts that you have set bigger.
So now, having restored an older configuration, still the status font and the general font are too little, but this time I shall avoid to modify them before having saved the image of the disk.

Well, sorry to have detailed so much, I just meant there really was no place on that form left, or the manipulations would have been very, very heavy indeed, as the form takes the whole available place on the screen, and if I attempt to enlarge it, it can double its width before I am aware that the size changing even began.
 
if you cut and paste then you will lose any connections to event handlers you had.
Oh, so if I find no way to get place for a drag and drop, it will be a good thing if I realize I have to create a panel, before writing event methods on the controls.

Oh, or perhaps there is a more simple way (from a certain point of view): I modify the code to insert the controls, so that instead of being created on the form they are created on the panel. But then, their locations are not adjusted, and possibly I have to calculate them control by control.

Well, having said that, not sure that attributing the code again to the events would be longer.
 
Last edited:
The Document Outline window may also be used for this, at least you can drag a control into another container and keep existing event handlers, then fine tune placement etc in designer afterwards.
 
Solution
The Document Outline window may also be used for this, at least you can drag a control into another container and keep existing event handlers, then fine tune placement etc in designer afterwards.
Oh, this is really a good idea indeed, and I found a nice video on Youtube to explain me how to open it, even if the author is definitely not a native English speaker.
I could experiment moving a control into an existing panel. I presume that if needed the dimensions of the panel can be adjusted afterwards.
Thank you for your answer.
 
Back
Top Bottom