Posicionar una forma "on top"

04/10/2004 - 21:53 por Aldo S. | Informe spam
Hola,

Disculpen la pregunta.

Como se puede hacer que una forma permanezca encima de las demas formas en
una aplicación ?.

Quiero decir sin utilizar la propiedad "TopMost" ya que esta hace que la
forma permanezca arriba en todas las aplicaciones.

Gracias de Antemano.
Aldo.
 

Leer las respuestas

#1 Octavio Hernandez
05/10/2004 - 08:01 | Informe spam
Aldo,

Me parece (pero no estoy 100% seguro) que no se puede lograr eso mediante
una método o prop de la clase Form.
Pero sí lo puedes lograr haciendo una llamada (mediante PInvoke) a función
SetWindowPos() de la API de Windows, pasando como segundo parámetro
HWND_NOTOPMOST.
Te adjunto la referencia de la función.
Puedes encontrar muchos ejemplos de PInvoke en la red, si tienes dudas
avísame.

Salu2 - Octavio

SetWindowPos moves a window to a new location on the screen. Its physical
coordinates, dimensions, and Z-order position (the Z-order determines which
windows are on top of others) can be set. The function returns 0 if an error
occured or 1 if successful.
hwnd
The handle of the window to move.
hWndInsertAfter
Either the handle of the window to position this window behind, or exactly
one of the following flags stating where in the Z-order to put the window:
HWND_BOTTOM = 1
Put the window at the bottom of the Z-order.
HWND_NOTOPMOST = -2
Put the window below all topmost windows and above all non-topmost
windows.
HWND_TOP = 0
Put the window at the top of the Z-order.
HWND_TOPMOST = -1
Make the window topmost (above all other windows) permanently.
x
The x coordinate of where to put the upper-left corner of the window.
y
The y coordinate of where to put the upper-left corner of the window.
cx
The x coordinate of where to put the lower-right corner of the window.
cy
The y coordinate of where to put the lower-right corner of the window.
wFlags
Zero or more of the following flags stating how to move the window:
SWP_DRAWFRAME = &H20
Same as SWP_FRAMECHANGED.
SWP_FRAMECHANGED = &H20
Fully redraw the window in its new position.
SWP_HIDEWINDOW = &H80
Hide the window from the screen.
SWP_NOACTIVATE = &H10
Do not make the window active after moving it unless it was already the
active window.
SWP_NOCOPYBITS = &H100
Do not redraw anything drawn on the window after it is moved.
SWP_NOMOVE = &H2
Do not move the window.
SWP_NOSIZE = &H1
Do not resize the window.
SWP_NOREDRAW = &H8
Do not remove the image of the window in its former position,
effectively leaving a ghost image on the screen.
SWP_NOZORDER = &H4
Do not change the window's position in the Z-order.
SWP_SHOWWINDOW = &H40
Show the window if it is hidden.

"Aldo S." escribió en el mensaje
news:%
Hola,

Disculpen la pregunta.

Como se puede hacer que una forma permanezca encima de las demas formas en
una aplicación ?.

Quiero decir sin utilizar la propiedad "TopMost" ya que esta hace que la
forma permanezca arriba en todas las aplicaciones.

Gracias de Antemano.
Aldo.



Preguntas similares