I'm trying to set all anchors on a control via code. Is there a way to do it? Or is there different way to achieve the same result?
Printable View
I'm trying to set all anchors on a control via code. Is there a way to do it? Or is there different way to achieve the same result?
Perform a bitwise OR operation:A Bitwise OR will set a bit in the result if that bit is set in either operand. Each AnchorStyles value has one and only one bit set, plus each is different to the others. In binary that operation looks something like this:VB Code:
myControl.Anchor = AnchorStyles.Top Or AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.RightCode:00000001
00000010
00000100
00001000
---------
00001111
Thanks. I'll give it a try.
*edit*
Works perfectly! Thanks J.