Integer li_i, li_width, li_count, li_height
Datawindow ldw_toolbar
UserObject luo_toolbar
For li_i = 1 To UpperBound ( Control )
if not isvalid(control[li_i]) then return
If Lower ( Control [ li_i ].ClassName ( ) ) = "cb_toolbar" Then
If Control [ li_i ].TypeOf ( ) = datawindow! Then
ldw_toolbar = Control [ li_i ]
li_width = This.WorkSpaceWidth ( )
ldw_toolbar.Width = li_width
Else
luo_toolbar = Control [ li_i ]
li_width = newwidth
luo_toolbar.Resize ( li_width , luo_toolbar.Height )
luo_toolbar.Dynamic Event ext_Resize ( )
End If
Exit
End If
Next
DragObject ldo_object
GraphicObject lgo_parent
UserObject luo_Parent
Window lw_parent
Datawindow ldw_object
li_count = UpperBound ( istr_position )
For li_i = 1 To li_count
// Get parent coordinate
ldo_object = istr_position [ li_i ].Object
lgo_parent = ldo_object.GetParent ( )
Choose Case lgo_parent.TypeOf ( )
Case Window!
lw_parent = lgo_parent
li_width = newwidth
li_height = newheight
Case UserObject!
luo_parent = lgo_parent
li_width = luo_parent.Width
li_height = luo_parent.Height
End Choose
// 使控件随窗口缩放
//
//"FixedToRight" or FIXEDRIGHT?
//"FixedToBottom" or FIXEDBOTTOM?
//"FixedToRight&Bottom" or FIXEDRIGHTBOTTOM?
//"Scale" or SCALE?
//"ScaleToRight" or SCALERIGHT?
//"ScaleToBottom" or SCALEBOTTOM?
//"ScaleToRight&Bottom" or SCALERIGHTBOTTOM?
//"FixedToRight&ScaleToBottom" or FIXEDRIGHT_SCALEBOTTOM?
//"FixedToBottom&ScaleToRight" or FIXEDBOTTOM_SCALERIGHT
PowerObject lpo_parent
Window lw_parent
UserObject luo_parent
Integer li_i
lpo_parent = ado_source.GetParent ( )
Integer li_parentwidth, li_parentheight, li_right, li_bottom
// 判断parent对象类型
Choose Case lpo_parent.typeOf ( )
Case Window!
lw_parent = lpo_parent
li_parentwidth = lw_parent.WorkSpaceWidth ( )
li_parentHeight = lw_parent.WorkSpaceHeight ( )
Case UserObject!
luo_parent = lpo_parent
li_parentWidth = luo_parent.Width
li_parentHeight = luo_parent.Height
End Choose
Method = Lower ( Method )
If Method <> "scaletobottom" And Method <> "fixedtoright" And Method <> "fixedtobottom"&
AND Method <> "fixedtoright&bottom" &
And Method <> "scaletoright" And Method <> "scaletobottom" And Method <> "scaletoright&bottom" &
And Method <> "FixedToRight&ScaleToBottom" And Method <> "FixedToBottom&ScaleToRight" Then
gnv_app.of_Message ( "程序设计错误:传入of_registerzoom参数出错!" )
Return -1
End If
1.定义实例变量:
uo_resize io_resize
2.在窗口的open事件中:
io_resize = create uo_resize
io_resize.setowner(this)
io_resize.regiester()
3.在窗口的close事件中:
destroy io_resize
4.在窗口的resize事件中:
io_resize.resize()
-----------------------
$PBExportHeader$uo_resize.sru
forward
global type uo_resize from nonvisualobject
end type
end forward
type shape from structure
long x
long y
long width
long height
end type
global type uo_resize from nonvisualobject
event zmemo ( )
end type
global uo_resize uo_resize
type variables
shape is_shape[], is_ownershape
DragObject is_control[]
forward prototypes
public function integer regiester ()
public function boolean unregister ()
public subroutine resize ()
public function boolean setowner (window ao_owner)
public function boolean setowner (userobject ao_onwer)
public function boolean setowner (tab ao_owner)
end prototypes