Hiccups in C # User Control - Resizing Components

I am having difficulty with a custom control on my order, and my search on Stack Overflow, MSDN, and Google did not reveal any problems similar to the ones I am experiencing.

I have a very simple user control: this is a shortcut, text field and button with SaveFileDialog and FolderSelectDialog available. The text box and button are pinned to the left, right, and right, respectively, with the intention of increasing the size of the control to increase the size of the space, and the button will remain on the right edge of the control.

The problem I am facing is that when you increase the control, the area to the right of the default width of the control becomes empty space when building and starting a project. The images here illustrate what I mean:

In the editor:

in editor

Duration:

running

The control in my development window is small, but when I add it to the form and expand it, it behaves as intended. However, when I run the form, the control was added, half of the control is not visible.

I suspect I'm missing something fairly straightforward, but I could not find anything by addressing this issue in my search. Help would be greatly appreciated.

+4
source share
1 answer

My guess is that there is a panel or something that is added to your control and will be brought to the forefront somehow at runtime.

from the properties window at the top is a combo from which you can select all the controls in User Control.

check if all the controls you need.

if you find that the panel or something deleted it :)

EDIT: This is not your problem.

Now I can only assume that you have set some pen sizes in your user control, i.e. in its constructor. in this case, the designer will show the correct size of the user control,

now some other place in your code, you again set the size of the user controls manually. if the layout is paused and the size changes, I think that the size of the bound controls will not change automatically.

If this is your problem, it is probably hard to find.

0
source

All Articles