My form with Borderstyle set to none and ControlBox and MaximizeBox and
MinimizeBox set to false stays on location 0;0 (topleft)
but I want the form centered to the screen, so I added in the formload event
:
Rectangle screen = Screen.PrimaryScreen.Bounds;
this.Location = new Point((screen.Width - this.Width) / 2,
(screen.Height - this.Height ) / 2);
no result ! the form stays on topleft location 0;0
Is the a solution for this problem ?
thanks
Peter.
Load Event Handler
{
Rectangle screen = Screen.PrimaryScreen.Bounds;
this.Location = new Point((screen.Width - this.Width) / 2,
(screen.Height - this.Height ) / 2);
//
// below goes new code
//
this.Capture = true;
IntPtr hwnd = OpenNETCF.Win32.Win32Window.GetCapture();
this.Capture = false;
OpenNETCF.Win32.Win32Window.SetWindowPos(hwnd,
Win32Window.SetWindowPosZOrder.HWND_TOP, this.Location.X,
this.Location.Y, this.Width, this.Height, 0);
}
Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com
the code you gave is working on a WinCe 4.2 device.
the code :
>>>Rectangle screen = Screen.PrimaryScreen.Bounds;
>>> this.Location = new Point((screen.Width - this.Width) / 2,
> >>(screen.Height - this.Height ) / 2);
is not working on my wince 4.2 device ! (for a borderless form)
your code and the OpenNet code did the trick.
Kind regards
Peter.
"Sergey Bogdanov" <sergey....@gmail.com> schreef in bericht
news:%23qkvweT...@TK2MSFTNGP12.phx.gbl...