pb_pfc_窗体居中

pfc中,窗体居中,可以直接使用窗体的服务,代码如下:

of_SetBase(True)
inv_base.of_Center()
十分简单。第一句启用窗体服务,第二句,调用服务的居中函数,如果不使用pfc,我们可以直接把of_Center函数拷贝出来,自己建一个函数用,代码如下:

Integer		li_screenheight
Integer		li_screenwidth
Integer		li_rc
Integer		li_x = 1
Integer		li_y = 1
environment	lenv_obj

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

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

// 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
End If

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

// Center window
li_rc = iw_requestor.Move (li_x, li_y)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
运行效果 http://hi.csdn.net/attachment/201012/9/0_1291865794j998.gif ************************************************************************* PowerBuilder Foundation Class Library Version 9.0 R E L E A S E N O T E S Copyright ?1996-2003 Sybase, Inc. and its subsidiaries. All rights reserved. ************************************************************************* Last Updated: January 17, 2003 ************************************************************************* Please take a few minutes to review this file for fixes that were made in PowerBuilder 8.0.2 and 9.0. ************************************************************************* BUG FIXES IN PFC 9.0 ************************************************************************* CR300376 Object: pfc_n_cst_fileSrv, pfc_n_cst_fileSrvwin32 Method: OfGetDiskSpace Fix: Method returned a negative number when the calculated amount of free disk space exceeded 2 gigabytes. Added new method of_GetDiskSpaceEx that takes decimals as arguments instead of longs. of_GetDiskSpace will be obsolete in a future release. ************************************************************************* BUG FIXES IN PFC 8.0.2 ************************************************************************* PFC.PBR CR256529 Fix: The PFC.PBR file can be used to copy bitmaps and dynamically referenced DataWindow objects into the executable file for deployment. The following bitmap files that were removed from PFC have now been removed from the PFC.PBR file: details.bmp, helptop.bmp, largeico.bmp, listv.bmp, and smallico.bmp. ======================================================== PFC DataStore CR261992 Object: pfc_u_ds Method: pfc_print/pfc_printdlg Fix: Changed the return code test to check for 1 on success, otherwise there is an error or the user cancelled. Fix: Set the

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值