当前位置: 代码迷 >> PB >> <>pb窗口最大化有关问题
  详细解决方案

<>pb窗口最大化有关问题

热度:535   发布时间:2016-04-29 10:37:34.0
<求助>pb窗口最大化问题
窗口编辑好后运行,点最大化但是窗口内的内容不能最大化,空出一大片空白,这严重影响美观,而且没有达到最大化的效果,本人初学者还请高手帮忙,小弟感激不尽阿~

------解决方案--------------------
你再resize里控制窗体上控件的大小
------解决方案--------------------
你在窗口的resize事件里面写代码:
给你这段代码:

//===================================
// 重新设置控件布局
//===================================
Integer i, li_control, li_MarginX, li_MarginY
String ls_move, ls_resize
DragObject ldrag_object,ldrag_parent,ldrag_tmp

If Not(This.WindowType = MDI! Or This.WindowType = MDIHelp!) Then
li_control = inv_control.Of_GetControlCount()

For i = 1 to li_control

ldrag_object = inv_control.of_GetControl(i)
ls_move = inv_control.of_GetMove(i)
ls_resize = inv_control.of_GetResize(i)
li_MarginX = inv_control.of_GetMarginX(i)
li_MarginY = inv_control.of_GetMarginY(i)

IF ldrag_object.GetParent().ClassName() = This.ClassName() THEN
CHOOSE CASE Upper(ls_move)
CASE 'RIGHT'
ldrag_object.Move(This.width - li_MarginX - ldrag_object.width, ldrag_object.y)
CASE 'BOTTOM'
ldrag_object.Move(ldrag_object.x, This.height - li_MarginY - ldrag_object.height)
CASE 'BOTH'
ldrag_object.Move(This.width - li_MarginX - ldrag_object.width, This.height - li_MarginY - ldrag_object.height)
END CHOOSE

CHOOSE CASE Upper(ls_resize)
CASE 'RIGHT'
ldrag_object.Resize(This.width - li_MarginX - ldrag_object.x, ldrag_object.height) 
CASE 'BOTTOM'
ldrag_object.Resize(ldrag_object.width, This.height - li_MarginY - ldrag_object.y)
CASE 'BOTH'
ldrag_object.Resize(This.width - li_MarginX - ldrag_object.x, This.height - li_MarginY - ldrag_object.y) 
END CHOOSE
ELSE
ldrag_parent = ldrag_object.GetParent()
CHOOSE CASE Upper(ls_move)
CASE 'RIGHT'
ldrag_object.Move(ldrag_parent.width - li_MarginX - ldrag_object.width, ldrag_object.y)
CASE 'BOTTOM'
ldrag_object.Move(ldrag_object.x, ldrag_parent.height - li_MarginY - ldrag_object.height)
CASE 'BOTH'
ldrag_object.Move(ldrag_parent.width - li_MarginX - ldrag_object.width, ldrag_parent.height - li_MarginY - ldrag_object.height)
END CHOOSE

CHOOSE CASE Upper(ls_resize)
CASE 'RIGHT'
ldrag_object.Resize(ldrag_parent.width - li_MarginX - ldrag_object.x, ldrag_object.height) 
CASE 'BOTTOM'
ldrag_object.Resize(ldrag_object.width, ldrag_parent.height - li_MarginY - ldrag_object.y)
CASE 'BOTH'
ldrag_object.Resize(ldrag_parent.width - li_MarginX - ldrag_object.x, ldrag_parent.height - li_MarginY - ldrag_object.y) 
END CHOOSE
END IF
Next
End if

If This.width < il_MinWidth Then
This.width = il_MinWidth
End if

If This.Height < il_MinHeight Then
This.height = il_MinHeight
End if

我们一直用的,你考进去就行了。
------解决方案--------------------
2楼正解。
在窗体preopen 事件中 用Resize
------解决方案--------------------
$PBExportHeader$f_windowscreen.srf
$PBExportComments$根据不同分辨率改变窗口和控件大小,以及字体大小。参数:窗口名,开发环境分辨率。如:f_windowscreen(this,1024,768)
global type f_windowscreen from function_object
end type
forward prototypes
global function integer f_windowscreen (readonly window arwin, integer arx, integer ary)
end prototypes
global function integer f_windowscreen (readonly window arwin, integer arx, integer ary);environment env
int ii_Screenwidth,ii_Screenheight
double WRadio,HRadio,Radio
int ii_WinBolderwidth,ii_WinBolderheight
getenvironment(env)
ii_WinBolderwidth=arwin.width - arwin.workspacewidth()//取得窗体边框的宽度
  相关解决方案