• Viernes 19 de Abril de 2024, 00:01

Autor Tema:  Q Funcion Centra Una Ventana Child En Mdi?  (Leído 1807 veces)

edsoniv

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
Q Funcion Centra Una Ventana Child En Mdi?
« en: Martes 29 de Junio de 2004, 01:43 »
0
Necestio saber como centro una ventana child no mediante codigo sino con una funcion propia q lo realice se q existe pero no la encuentro ahhhhhhh  :lightsabre:

ccasti

  • Nuevo Miembro
  • *
  • Mensajes: 14
    • Ver Perfil
Re: Q Funcion Centra Una Ventana Child En Mdi?
« Respuesta #1 en: Martes 10 de Agosto de 2004, 05:27 »
0
yo utilizo una funcio para centrar las ventanas que espero te sirva:

declaras las siguientes variables de instancia:
int l_xx, l_yy

y creas la funcion f_center() y colocas el siguiente script:

__________________

//*-----------------------------------------------------------------*/
//*    f_Center:  Center the window
//*-----------------------------------------------------------------*/
int li_screenheight, li_screenwidth, li_rc, li_x=1, li_y=1
environment   lenv_obj

/*  Check for a window association with this object  */
If IsNull ( this ) Or Not IsValid ( this ) Then Return -1

/*  Get environment  */
If GetEnvironment ( lenv_obj ) = -1 Then Return -1

/*  Determine current screen resolution and validate  */
li_screenheight = PixelsToUnits ( lenv_obj.ScreenHeight, YPixelsToUnits! )
li_screenwidth  = PixelsToUnits ( lenv_obj.ScreenWidth, XPixelsToUnits! )
If Not ( li_screenheight > 0 ) Or Not ( li_screenwidth > 0 ) Then Return -1

/*  Get center points  */
If li_screenwidth > this.Width Then
   li_x = ( li_screenwidth / 2 ) - ( this.Width / 2 )
End If
If li_screenheight > this.Height Then
   li_y = ( li_screenheight / 2 ) - ( this.Height / 2 )
End If

/*  Center window  */
li_rc = this.Move ( li_x, li_y )
If li_rc <> 1 Then Return -1

Return 1
_________________________

Espero que te sirva,

saludos
Carlos