sethindeed Posted February 13, 2003 Posted February 13, 2003 When I want to set the left, top, height, width property on a form, I can easily do it. However, I noticed that when a control is on a groupbox, it takes the dimension of the groupbox to define these properties. example : Label1 on a groupbox at the far right will have the left property set to 10. How do I refer to the groupbox when I set the location at runtime ? thx Quote What I don't know keeps me excited...
*Gurus* divil Posted February 13, 2003 *Gurus* Posted February 13, 2003 When you set positions of controls, you are _always_ referring to the bounds within the parent. If you set the .Left property of a Label within a Groupbox, then that coordinate will be relative to the left-hand side of the groupbox. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
sethindeed Posted February 13, 2003 Author Posted February 13, 2003 OK but suppose that I load all my controls at runtime. My label does not know that I am about to put it on a groupbox. Is there a way to add a control to a groupbox ? Quote What I don't know keeps me excited...
Moderators Robby Posted February 13, 2003 Moderators Posted February 13, 2003 try this... GroupBox1.Controls.Add(Label1) And then if you get/set the Left of the Label it will be in relation to the Groupbox (As Divil said) Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.