It's been a few days, it's notificatory, please help

xiaoxiao2021-03-06  43

Dear masters, I am a VB beginner. Now I have compiled a small program company, but the company has a notebook, some use a desktop, the resolution is 1024 * 768 and 800 * 600, but I use 800 * 600 Programming, now the notebook users always feel awkward, I downloaded a few code that automatically adapt to the resolution online, but the form is getting bigger, I don't know if I don't know It is still not available. Please expert guidance. The code is as follows: 1, in the standard module section Option ExplicitPrivate FormoldWidth as long 'Save the original Width of the FormoldHeight as long' Save the original height of the form

'Before calling this function first calls ResizeForm Public Sub ResizeInit (FormName As Form) Dim Obj As Control FormOldWidth = FormName.ScaleWidth FormOldHeight = FormName.ScaleHeight On Error Resume Next For Each Obj In FormName Obj.Tag = Obj.Left & "" & Obj.top & "_ & obj.width &" "& obj.height &" "Next Obj On Error Goto 0nd Sub

'Change the size of each component in the scale, call ResizeInit function before calling ResizeInit function PUBLIC SUB Resizeform (4) AS Double Dim I as long, Temppos As Long, StartPOS As Long Dim Obj AS Control DIM SCALEX As Double, Scaley As Double

ScaleX = FormName.ScaleWidth / FormOldWidth 'Save Form width scaling ScaleY = FormName.ScaleHeight / FormOldHeight' Save Form height scale On Error Resume Next For Each Obj In FormName StartPos = 1 For I = 0 To 4 'read control Original location and size

Temppos = instr (startpos, obj.tag, "", vbtextcompare) if Temppos> 0 THEN POS (i) = MID (Obj.tag, StartPos, Temppos - StartPos) StartPos = Temppos 1 else POS (i) = 0 END IF 'Raw position according to the original position and form of the control to react and change the size Obj.move POS (0) * Scalex, POS (1) * Scaley, _ POS (2) * scalex, POS (3) * Scaley Next I Next Obj On Error Goto 0nd Sub2, Form Some Private Sub Form_Load ()

Call resizeinit (me) must join End Sub when loading

PRIVATE SUB FORM_RESIZE ()

Call resizeform (me) 'ensures that the control will change when the form changes

End Sub

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

New Post(0)