Setting initial Form location

  • Thread starter Thread starter Peter Oliphant
  • Start date Start date
P

Peter Oliphant

I've tried to set up a Form location via its constructor in the following
way (My_Form is derived as a child of the standard Form):

My_Form( int x, int y, int w, int h )
{
Rectangle rect( x, y, w, h ) ;
this->Bounds = rect ;
} ;

When I do this the width and height are properly set, but it doesn't place
in proper (x,y) location. I've also tried setting up Width, Height, Top, and
Left independently, and again, width and height work but not the location.
Why? And what SHOULD I do to setup (x,y) prior to ShowDialog()?
 
PS - If I read the form's Top and Left properties they SAY it's in the
location I said to put the form, but it obviously is NOT at that location on
the screen! (I've also tried the Location property). Is it possible you
CAN'T set up its location in a constructor?

BTW, I forgot to mention that I also call the Form() default constructor
ala:

My_Form( int x, int y, int w, int h ) : Form() // <= Form constructor
{
Rectangle rect( x, y, w, h ) ;
this->Bounds = rect ;
} ;
 
Back
Top