Make the control with the windows grow

xiaoxiao2021-03-06  35

Option expedition

Private Type Controlsize

Name as string 'control name

X as single 'left distance ratio

Y askLE 'ratio ratio

CX as salesle 'width ratio

Cy as single 'length ratio

End Type

DIM arrsize () AS Controlsize

Private sub flow_load ()

Redim arrsize (0) AS ControlSize

Savesize Command1

Saveise command2

End Sub

PRIVATE SUB FORM_RESIZE ()

If me.windowstate = 1 THEN

EXIT SUB

END IF

Resize Command1

Resize Command2

End Sub

Private Sub Resize (Obj As Object)

DIM I as integer

DIM J AS INTEGER

J = ubound (arrsize ())

For i = 1 to j

IF arrsize (i) .name = obj.name dam

EXIT for

END IF

Next i

IF i> j Then

EXIT SUB

Else

Obj.left = arrsize (i) .x * me.scalewidth

Obj.top = arrsize (i) .y * me.scaleheight

Obj.width = arrsize (i) .cx * me.scalewidth

Obj.height = arrsize (i) .cy * me.scaleHeight

END IF

End Sub

Private sub savesize (Obj as object)

DIM Count As Integer

Count = ubound (arrsize)

Redim preserve arrsize (count 1)

Arrsize (count 1) .Name = obj.name

Arrsize (count 1) .x = obj.left / me.scalewidth

Arrsize (count 1) .y = obj.top / me.scaleHeight

Arrsize (count 1) .cx = obj.width / me.scalewidth

Arrsize (count 1) .cy = obj.height / me.scaleheight

End Sub

转载请注明原文地址:https://www.9cbs.com/read-66189.html

New Post(0)