A class implementation window separator function.

xiaoxiao2021-03-06  52

The following is a class code

Option expedition

Private myform as form 'Application Form

Private PICP as Object 'as a partition control

Private ObjBox1 As Object 'Division Left Control

Private ObjBox2 As Object 'Separation Right Control

Private sub coplass_terminate ()

Set myform = Nothing

SET PICP = Nothing

Set objBox1 = Nothing

Set objBox2 = Nothing

End Sub

Public Sub Myinit (Inform As Form, Pic As Object, Obj1 As Object, Obj2 As Object)

ON Error Goto Err1

'Initialize each control position

Set myform = inform

SET PICP = PIC

Set objBox1 = Obj1

Set objBox2 = Obj2

Picp.mousepointer = 9

Picp.appearance = 0

Picp.backcolor = & h8000000f

Picp.Borderstyle = 0

Picp.width = 50

ObjBox1.top = 0

ObjBox1.Left = 0

ObjBox1.width = 3000

ObjBox1.height = myform.height

Picp.top = 0

Picp.Left = ObjBox1.width

Picp.height = myform.height: ObjBox2.top = 0

ObjBox2.Left = ObjBox1.width Picp.width

ObjBox2.height = myform.height

ObjBox2.width = myform.width - ObjBox1.width - Picp.width

Picp.zorder (0)

EXIT SUB

Err1:

End Sub

Public Sub MyMouseMove (MouseButton As Integer, x as single)

ON Error Goto Err1

'Tune in the MouseMove event of the PICP control

If MouseButton = 1 THEN

Picp.Move Picp.Left X

ObjBox1.width = Picp.Left

ObjBox2.Left = Picp.Left 50

ObjBox2.Width = myform.width - Picp.Left

Picp.zorder (0)

END IF

EXIT SUB

Err1:

End Sub

Public Sub MyMouseUp (MouseButton as Integer)

ON Error Goto Err1

'Tune in the MouseUp event of the PICP control

If MouseButton = 1 THEN

ObjBox1.Left = 0

IF Picp.left <1000 Then

ObjBox1.width = 1000Picp.Left = 1000

Else

IF Picp.Left> MyForm.width Then

ObjBox1.width = MyForm.width - 1000

Picp.Left = ObjBox1.width

Else

ObjBox1.width = Picp.Left

END IF

END IF

ObjBox2.Left = ObjBox1.width Picp.width

ObjBox2.width = myform.width - ObjBox1.width - Picp.width

END IF

EXIT SUB

Err1:

End Sub

'The following is the window code, add a PictureBox control and two TextBox controls.

Option expedition

Dim a as class1

Private sub flow_load ()

Set a = new class1

A.MYINIT ME, Picture1, Text1, Text2

End Sub

Private Sub Picture1_mousemove (Button As Integer, Shift As Integer, X as single, y as single)

A.MYMOMOVE button, X

End Sub

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

New Post(0)