//Function Name : f_window_center
//Argument Name : aw_wnd, Arg Type : window, Pass By : ReadOnly
//Return Type : (None)
int li_screenheight, li_screenwidth, li_x=1, li_y=1
environment lenv_obj
If isNull(aw_wnd) OR NOT isValid(aw_wnd) Then Return
If GetEnvironment( lenv_obj ) = -1 Then Return
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
If li_screenwidth > aw_wnd.Width Then
li_x = ( li_screenwidth / 2 ) - ( aw_wnd.Width / 2 )
End If
If li_screenheight > aw_wnd.Height Then
li_y = ( li_screenheight / 2 ) - ( aw_wnd.Height / 2 )
End If
aw_wnd.Move( li_x, li_y )
Return
0 comments:
Post a Comment