DataGrid en forms "TopMost"

24/08/2004 - 16:35 por JAZ | Informe spam
Al crear un Windows Form con la propiedad TopMost=TRUE,
queda siempre visible por encima de cualquier otra
ventana. Sin embargo, si se incluye un
control "DataGrid", parece ignorar esa propiedad.

¿Que debe hacerse para no perder ese funcionamiento?
 

Leer las respuestas

#1 Alejandro Perez
24/08/2004 - 17:34 | Informe spam
Hola Jaz... esto es un grave bug lamentablemente. Prueba
utilizando la funcion API SetWindowPos.

Algo asi:

private const uint SWP_NOMOVE=0x0002;
private const uint SWP_NOSIZE=0x0001;
private const uint SWP_NOACTIVATE = 0x0010;
private const int HWND_TOPMOST = -1;
private const int HWND_NOTOPMOST = -2;

[DllImport("USER32.dll")]
extern public static bool SetWindowPos(IntPtr hWnd, IntPtr
hWndInsertAfter, int X, int Y, int cx, int cy, uint
uFlags);

Y en el evento Paint del datagrid haz la llamada...

SetWindowPos((IntPtr)this.Handle.ToInt32(),(IntPtr)
HWND_TOPMOST, 0, 0, 0,
0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);


Avisame ;)

Bye

Alejandro Perez
MCSD/MCDBA/MCT
Caracas - Venezuela

Al crear un Windows Form con la propiedad TopMost=TRUE,
queda siempre visible por encima de cualquier otra
ventana. Sin embargo, si se incluye un
control "DataGrid", parece ignorar esa propiedad.

¿Que debe hacerse para no perder ese funcionamiento?
.

Preguntas similares