-
Nov 19th, 2011, 12:05 PM
#1
Thread Starter
Member
Child Control Anchoring and Padding Problem
Hello,
I've searched in these forums and online, and returned zero results. I'm curious to know if anyone else has experience this problem.
If you have a Control contained within another Control and the Child Control has the default Anchoring (Top + Left) AND AutoSize=False (Assuming the control has that Property) changing the Parent Control's Top or Left Padding will not offset the Child Control.
If you change the Anchoring of the Child Control to anything other than the default values OR set AutoSize=True, the Control is correctly offset when the Parent Control's Padding values are changed.
Is this a bug, or am I missing the reason behind this functionality?
-
Nov 19th, 2011, 08:06 PM
#2
Re: Child Control Anchoring and Padding Problem
EDIT: I must have been half asleep when I posted my advice below, because it doesn't really address the question. Sorry.If you anchor the child control to the top and left, it will stay the same pixel distance from the top and left of the parent. It's size won't change. If you anchor it to bottom and right, it will stay the same distance from the parent's bottom and right.
If you anchor the child to left and right, it will stretch horizontally to keep the distance from the left and right unchanged. Similarly, if you you anchor it to top and bottom, it will stretch vertically to keep the distances unchanged.
I hope you can figure out the rest.
BB
Last edited by boops boops; Nov 20th, 2011 at 04:54 AM.
-
Nov 19th, 2011, 11:59 PM
#3
Re: Child Control Anchoring and Padding Problem
Changing Padding and Margin values should not have any immediate impact on any control. Those properties only affect the snapping functionality in the designer, which is only relevant when actually dragging a control. Can you provide a set of steps we can follow to demonstrate this alleged bug?
-
Nov 20th, 2011, 03:14 PM
#4
Re: Child Control Anchoring and Padding Problem
Originally Posted by jmcilhinney
Changing Padding and Margin values should not have any immediate impact on any control. Those properties only affect the snapping functionality in the designer, which is only relevant when actually dragging a control. Can you provide a set of steps we can follow to demonstrate this alleged bug?
They are more than a snapping aid. The padding takes effect when you dock a child control into its container. In container controls that perform auto layout, such as a FlowLayoutPanel or Toolstrip, the margins of the child controls are also effective; the margins may overlap the padding of the parent, but not each other. Whether this has any bearing on the OP's question remains to be seen. We don't know what kind of controls he was using.
BB
-
Nov 20th, 2011, 10:54 PM
#5
Thread Starter
Member
Re: Child Control Anchoring and Padding Problem
Originally Posted by jmcilhinney
...Can you provide a set of steps we can follow to demonstrate this alleged bug?
The following steps are done within the Designer.
- Start with a blank Form or an empty Panel. (I think any container control might yield the same results.)
- Add a Label and a Button to the Control from (1).
- Leave all of the properties for the Controls set to their default values.
- Change either the Top or Left Padding value (or both) for the Control from (1) to 50 (or some other value that would be easy to notice Control repositioning). You should notice that the Label is offset, while the Button is not.
- Set all of the Padding values for the Control from (1) back to 0. The Label should return to its original position.
- Change the Anchoring property of the Button to anything other than Top + Left.
- Change the respective Padding value (Top, Left, etc.) for the Control from (1). Now, both the Button and the Label should be offset.
- Set all of the Padding values for the Control from (1) back to 0. Both the Button and the Label should be in their original positions.
- Change the Anchoring property of the Button back to Top + Left.
- Set the Button's Autosize property to True.
- Change any of the Padding values for the Control from (1). Both the Button and the Label should be in their original positions.
I should point out that the Anchoring values set will affect how the button is offset by the padding. The same rules that govern how the control is repositioned when it's Parent Container is resized are the same with Padding.
Originally Posted by boops boops
We don't know what kind of controls he was using.
I've found that this feature is found in any Controls that have both an Anchoring Property and an Autosize Property.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|