f_wcenter.srf 571 B

123456789101112131415161718192021222324
  1. $PBExportHeader$f_wcenter.srf
  2. $PBExportComments$把窗口移到主窗口的中间--函数
  3. global type f_wcenter from function_object
  4. end type
  5. forward prototypes
  6. global subroutine f_wcenter (window f_win)
  7. end prototypes
  8. global subroutine f_wcenter (window f_win);//把窗口移到主窗口的中间
  9. int lx=640,ly=480
  10. environment env
  11. if GetEnvironment(env)=1 then
  12. lx=env.ScreenWidth
  13. ly=env.ScreenHeight
  14. end if
  15. lx=PixelsToUnits(lx,XPixelsToUnits!)
  16. ly=PixelsToUnits(ly,YPixelsToUnits!)
  17. lx=(lx -f_win.Width)/2
  18. ly=(ly -f_win.Height)/2
  19. f_win.Move(lx,ly)
  20. end subroutine