The simple answer is this is not possible. When you set an
anchor, the dock style clears. And vise versa if you set the dock style.
Under the covers, we use the same bit fields to represent dock and anchor, so
it is not possible to get into a conflicting state.
Anchor Scenarios
These scenarios are in a form which employs a dock and
anchor layout engine.
Keeping a fixed distance from an edge – If you have a
control you want to remain a fixed distance from an edge of the parent.
![]()
Anchor Bottom|Right
Resizing a child control when the parent grows/shrinks – If
you have a control you want to resize when the parent resizes using opposite
anchors (Left | Right) or (Top | Bottom) will help maintain the same distance
from the edge as the parent resizes.
![]()
Anchor = Top|Bottom Anchor =
Left|Right
Dock Scenarios
These scenarios are in a form which employs a dock and
anchor layout engine.
Always glued to one edge of the form - Dock Layout
can generally be represented by combinations of Anchors, but it's quite handy
for things that always need to be glued to one edge of the parent control.
![]()
Splitter layouts – through a combination of Dock
styles, splitter style layouts can be achieved. This scenario is not as
important in Whidbey, as we have provided a SplitContainer to do this layout
magic for you.
![]()