views:

666

answers:

2

I added some controls to my form and changed Anchor property how I'd expect this to work, but when I resize the form at the runtime, the controls stay at the same place.

For example, I have two buttons in bottom right corner of a form - they are on the form, no containers or anything like that. Anchor = Bottom, Right. FormBorderStyle = Sizable. But when I drag-resize the form while running, buttons do not move.

Am I missing something?

c# 2005

+1  A: 

What is the Dock property set to? This can negate the anchor properties.

Nate Shoffner
For the buttons, right? It's set to "None"
flamey
+3  A: 

Another possibility would be that you accidentally placed your buttons not directly on the form. Instead you put them in some container (eg. panel, tableLayoutPanel, etc) and this container doesn't have set its anchoring or docking values correct.

Just to be absolutely sure you should take a look into designer.cs and check if your buttons are added directly to the form by this.Controls.Add() function or if they are added in any other Controls-List (eg. panel.Controls.Add()).

Oliver
If you want a hierarchical overview of all your controls on the form, just open the Document Outline panel.In design mode go to View -> Other Windows -> Document Outline
Mez
Oliver