Hi,

I have an application which shows forms on two different independant
screens. The Windows desktop is spread across these screens.
The forms are all set to manual positioning, and so to show a form on
the second screen, I simply set the coordinates to be on the second
screen and that is where it goes.

It now seems to have developed a problem however:
When I trace through what is happening all the coordinates get set
correctly, and then I call Show() for the form. When show returns, the
forms coordinates have been changed to show it on the first screen.

I can't trace into the Show function, as it's part of the framework, but
something weird is happening.

Has anybody seen this before or got any idea what could be going on?

Thankyou in advance.

Paul Cheetham.

Re: Forms are re-locating by Jared

Jared
Sun Sep 18 09:59:59 CDT 2005


Paul,
I wasn't able to recreate your problem. I created a new form, set the
StartPosition property to manual, and it positioned correctly on my second
monitor. It may be that you have a property that is affecting the Show
methods implementation when creating a window.

The documentation for the Show method states that calling show is the same
as setting the
forms visible property. The Win32 API to Framework map
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/win32map.asp)
maps the Show method (and visible property if I read the framework
documentation correctly) to
both the SetWinwsPos and ShowWindow API's.

I suspect that the frameworks internal implementation of these api calls are
dependant on certain properties of the form class, and if not set will cause
the problems you're describing.

The following seems to work correctly on my monitor configuration (dual
monitors, stretch desktop, primary (1280x1024) on the right,
secondary(1024x768) on the left.

Dim newForm As New Form

If (SystemInformation.MonitorCount > 1) Then

Dim secondaryBounds As Rectangle = _
Screen.AllScreens(1).Bounds
Dim secondaryMonitorTopLeft As New Point( _
secondaryBounds.X, secondaryBounds.Y)
newForm.StartPosition = FormStartPosition.Manual
newForm.Location = secondaryMonitorTopLeft
newForm.Text = String.Format( _
"New form - X={0} Y={1}", _
secondaryBounds.X, _
secondaryBounds.Y)
newForm.Show()

End If

Jared


"Paul Cheetham" <PAC.News@dsl.pipex.com> wrote in message
news:e9j4w06uFHA.3740@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> I have an application which shows forms on two different independant
> screens. The Windows desktop is spread across these screens.
> The forms are all set to manual positioning, and so to show a form on the
> second screen, I simply set the coordinates to be on the second screen and
> that is where it goes.
>
> It now seems to have developed a problem however:
> When I trace through what is happening all the coordinates get set
> correctly, and then I call Show() for the form. When show returns, the
> forms coordinates have been changed to show it on the first screen.
>
> I can't trace into the Show function, as it's part of the framework, but
> something weird is happening.
>
> Has anybody seen this before or got any idea what could be going on?
>
> Thankyou in advance.
>
> Paul Cheetham.
>



RE: Forms are re-locating by DWS

DWS
Mon Sep 19 06:37:05 CDT 2005

Paul,
I have came across a similar occurance. It was caused by clicking in the
secondary monitor screen area before form is displayed and only occurs when
the program is run outside of vs. I have a spash form that goes from the
center of screen and fades as it moves to the bottom right of the screen. If
I click in secondary monitor before my splash form is displayed then the
splash form starts in the center of secondary monitor but like I said earlier
this only occurs when the program is run outside of vs.

Good Luck
DWS


"Paul Cheetham" wrote:

> Hi,
>
> I have an application which shows forms on two different independant
> screens. The Windows desktop is spread across these screens.
> The forms are all set to manual positioning, and so to show a form on
> the second screen, I simply set the coordinates to be on the second
> screen and that is where it goes.
>
> It now seems to have developed a problem however:
> When I trace through what is happening all the coordinates get set
> correctly, and then I call Show() for the form. When show returns, the
> forms coordinates have been changed to show it on the first screen.
>
> I can't trace into the Show function, as it's part of the framework, but
> something weird is happening.
>
> Has anybody seen this before or got any idea what could be going on?
>
> Thankyou in advance.
>
> Paul Cheetham.
>
>