hansw77041
asked on
How to position a control on a form at run time
I have a form that can be resized.
I need to position the grid control so that it remains at X,Y relative to the top left of the form.
Point NewPos = new Point(20,50);
dataGridView1.Location = NewPos;
When I set a breakpoint dataGridView1.Location show 0,0 and not 20,50
Just what do I need to do to position a control where I want it.
I need to position the grid control so that it remains at X,Y relative to the top left of the form.
Point NewPos = new Point(20,50);
dataGridView1.Location = NewPos;
When I set a breakpoint dataGridView1.Location show 0,0 and not 20,50
Just what do I need to do to position a control where I want it.
>>I have a form that can be resized.
>>I need to position the grid control so that it remains at X,Y relative to the top left of the form.
Does it moves when you resize the form?
Do you want the grid to be resized with form? If so, you just have to set the grid's Anchor property to left,top,right,bottom
>>I need to position the grid control so that it remains at X,Y relative to the top left of the form.
Does it moves when you resize the form?
Do you want the grid to be resized with form? If so, you just have to set the grid's Anchor property to left,top,right,bottom
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That did it... thanks
then the statement has not executed as yet. So the location will still be the original vaue