Center control or container in a login page

Answered
0
0

Hi!
I try to create login page, i want to center dinamically horizontally and vertically a container in a page, even if I resize it.
My container (groupbox):
-username textcontrol
-password textcontrol
-login buttton

Any advice!
Thanks in advance

  • You must to post comments
Best Answer
2
0

Just put it into the center on the page in the designer and change the anchor of the groupbox to none.

  • You must to post comments
0
0

Hi Ser,

Write this on Load and ResponsiveProfileChanged events in the page:

 

// code for initializing the panel and setting 
// its size goes here

_thePanel.Location = new Point(
    this.ClientSize.Width / 2 - _thePanel.Size.Width / 2,
    this.ClientSize.Height / 2 - _thePanel.Size.Height / 2);
_thePanel.Anchor = AnchorStyles.None;

Regards
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.