打印本文 打印本文 关闭窗口 关闭窗口
窗体控件大小随窗体大小变化而变化
作者:武汉SEO闵涛  文章来源:敏韬网  点击数5406  更新时间:2009/4/23 18:59:53  文章录入:mintao  责任编辑:mintao
              If i < 0 Then
                     i = AddForm(pfrmIn)
              End If

       PerHeight = (pfrmIn.ScaleHeight * 100) \ FormRecord(i).ScaleHeight
End Function


Public Sub ResizeControl(inControl As Control, pfrmIn As Form)

       On Error Resume Next
       Dim i As Long
       Dim widthfactor As Single, heightfactor As Single
       Dim minFactor As Single
       Dim yRatio, xRatio, lTop, lLeft, lWidth, lHeight As Long
       yRatio = PerHeight(pfrmIn)
       xRatio = PerWidth(pfrmIn)
       i = FindControl(inControl, pfrmIn.Name)

              If inControl.Left < 0 Then
                     lLeft = CLng(((ControlRecord(i).Left * xRatio) \ 100) - 75000)
              Else
                     lLeft = CLng((ControlRecord(i).Left * xRatio) \ 100)
              End If

       lTop = CLng((ControlRecord(i).Top * yRatio) \ 100)
       lWidth = CLng((ControlRecord(i).Width * xRatio) \ 100)
       lHeight = CLng((ControlRecord(i).Height * yRatio) \ 100)
              If TypeOf inControl Is Line Then

                            If inControl.X1 < 0 Then
                                   inControl.X1 = CLng(((ControlRecord(i).Left * xRatio) \ 100) - 75000)
                            Else
                                   inControl.X1 = CLng((ControlRecord(i).Left * xRatio) \ 100)
                            End If

                     inControl.Y1 = CLng((ControlRecord(i).Top * yRatio) \ 100)

                            If inControl.X2 < 0 Then
                                   inControl.X2 = CLng(((ControlRecord(i).Width * xRatio) \ 100) - 75000)
                            Else
                                   inControl.X2 = CLng((ControlRecord(i).Width * xRatio) \ 100)
                            End If

                     inControl.Y2 = CLng((ControlRecord(i).Height * yRatio) \ 100)
              Else
                     inControl.Move lLeft, lTop, lWidth, lHeight
                     inControl.Move lLeft, lTop, lWidth
                     inControl.Move lLeft, lTop
              End If

End Sub

Public Sub ResizeForm(pfrmIn As Form)

       Dim FormControl As Control
       Dim isVisible As Boolean
       Dim StartX, StartY, MaxX, MaxY As Long
       Dim bNew As Boolean

              If Not bRunning Then
                     bRunning = True

                            If FindForm(pfrmIn) < 0 Then
                                   bNew = True
                            Else
                                   bNew = False
                            End If


                            If pfrmIn.Top < 30000 Then
                                   isVisible = pfrmIn.Visible
                                   On Error Resume Next

                                          If Not pfrmIn.MDIChild Then
                                                 On Error GoTo 0
                                                 ''''     '''' pfrmIn.Visible = False
                                          Else

                                                        If bNew Then
                                                               StartY = pfrmIn.Height
                                                               StartX = pfrmIn.Width
      &n

上一页  [1] [2] [3] [4] [5] [6] [7]  下一页

打印本文 打印本文 关闭窗口 关闭窗口