user control

R

RobcPettit

Hi, I hope I dont make a mess of this question, as Im new to c# my
terminology is a bit of, here goes. Ive started to make a windows
application and Ive added a usercontrol from another program, which
had already been layed out, and Im trying to understand the workings
of this user control. I think its a user control. In the original
project Igot this from, in then solution explorer I click on
usercontrol to display the design and in properties it refers to
system.windows.forms.usercontrol. The control represents a row, and in
the control is a label and 6 buttons all in a line. When I use this in
my program I can get it to do what I want and understand the
programming side. Its the design Im struggling with. For instance Ive
added 6 more labels to to the control. The original label was set to
fill, so I had to alter this to add my labels, then put the original
label back to fill. This is the bit that confusses me, the original
label fills to the original buttons, completly ignoring my labels. The
6 buttons seem to be loked together;
Original row;
Label(fills
to......................)button,button,button,button,button,button.
(encassed in usercontrol).
My row;

originalLabel,label,label,label,label,button,button,button,button,button,button.
(encassed in usercontrol).
originalLabel still fills to................
When I use this in my program I see all my labels and the original
label and buttons. Can anybody make sense of this question and give me
some advice. Ive googled plenty, and although there alot on
usercontrols I havent found anything to help.
Regards Robert
 
M

Morten Wennevik [C# MVP]

Hi Robert,

When using Docking on a Control it will cover any controls that aren't docked. If your labels aren't set to dock they will be hidden. Furthermore, when you dock, remember that a later control's docking will override previous docking, so if you add a Label A with DockStyle.Left and then a Label B also with DockeStyle.Left, B will push A towards the right since the docking of B was calculated last. To prevent this, add A after B or if you have code access, just edit the designer code and rearrange the order of control additions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top