TopMost = true Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an application that needs a window to stay on top of the other ones, I thought that TopMost = true would be suitable for this feature but it also makes this window to stay on top of all other application running on my PC, Does anybody know How can I prevent this TopMost window appear when I switch to the other applications??

_______________________
JaguarX
 
Jaguar,

Thats expected behaviour. Topmost forms are always displayed at the highest
point in the Z-order of the windows on the desktop.

If you want to set form toplevel for only the first time, use
SetForegroundWindow function. This will bring ur window during start.

To solve your problem, during Deactivate event of your application, set the
topmost property of the form to false. Then again during Activated event set
it to true.

Shak.


JaguarX said:
I have an application that needs a window to stay on top of the other
ones, I thought that TopMost = true would be suitable for this feature but
it also makes this window to stay on top of all other application running on
my PC, Does anybody know How can I prevent this TopMost window appear when I
switch to the other applications??
 
Hi,

Try using the Owned property of the form.

a) From your main form, call AddOwnedForm, OR
b) from the second form, set its Owner property.
 
Back
Top