|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Anchoring problem1. Create a new Form and set it's size to 229, 474. 2. Drag a Panel to the form and set the following properties: Size = 216, 438 Location = 3,1 Anchor = Top, Bottom 3. Add a PictureBox control to the top of the panel and set the following properties: Size = 210, 56 Location = 3,2 Anchor = Top, Left and then stick a image into the PictureBox 4. Add a LinkLabel control to the bottom of the panel and set the following properties: Text = "LinkLabel Test" Size = 126,13 Location = 52, 413 Anchor = Bottom, Left Run the program and try resizing the form. You'll notice as you make the form wider, the panel stays centered inside the form and if you expand the form vertically the link label will move up and down properly. So everything is working as it should. Now, I am creating a User Control which I just copied the above Panel to the UserControl and adding it to the Form like this: Dim c As New UserControl1 Me.Controls.Add(c) and run the program. You'll notice the anchoring no longer works and as you expand the form, the UserControl stays stationary in the top left corner of the form. How do I get the UserControl to behave just like the Panel being added to the form? This has been very frusturating for me over the past few days since I have tried setting the anchor programatically when creating the control and adding it to the form like this: Dim c As New UserControl1 c.Anchor = AnchorStyle.Top And AnchorStyle.Bottom Me.Controls.Add(c) That just causes the UserControl to center itself on the Form and the Panel inside the UserControl ignores the anchors set. What am I doing wrong? Please help! > c.Anchor = AnchorStyle.Top And AnchorStyle.Bottom Try: c.Anchor = AnchorStyle.Top OR AnchorStyle.BottomJosip,
You be the man! That worked! It was just the syntax all along, geez. Show quoteHide quote "Josip Medved" wrote: > > c.Anchor = AnchorStyle.Top And AnchorStyle.Bottom > > Try: c.Anchor = AnchorStyle.Top OR AnchorStyle.Bottom > > > -- > Greetings, > Josip Medved > http://www.jmedved.com > > How do I get my UserControl to resize itself properly after I remove it from
the form and then add it again. If I resize form and add the UserControl it appears in the upper left hand corner and looses it's anchor capabilities. Show quoteHide quote "Josip Medved" wrote: > > c.Anchor = AnchorStyle.Top And AnchorStyle.Bottom > > Try: c.Anchor = AnchorStyle.Top OR AnchorStyle.Bottom > > > -- > Greetings, > Josip Medved > http://www.jmedved.com > >
rewriting URL
appsetting in class doesn't work SerlializationException Please help, about primary key and dataset xml file format Speeding up array/file loading Export function from VB.Net DLL Dynamically iterating through log files passing parameter to class from application my class library doesn't contain an assembly - how to add an assem |
|||||||||||||||||||||||