⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cresize.cls

📁 获得编辑框文本
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CResize"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'****************************************************************
'Get my full resize class project from the same site.
'-> www.freevbcode.com
'-> www.planet-source-code.com
'-> www.vbcode.com

'You are free to use this class in your own projects n give me some credits
'when you do. Dont forget to visit my web site k?
'                                       --- Author, Muhammad Abubakar
'                                       <joehacker@yahoo.com>
'                                       http://go.to/abubakar
'****************************************************************
Option Explicit

Enum eParams
    TopOnly = 1
    LeftOnly = 2
    Top_Left = 3
    HeightOnly = 4
    WidthOnly = 5
    Height_Width = 6
End Enum
Private Type cInfo
    cControl As Control
    cHeight As Integer
    cWidth As Integer
    cTop As Integer
    cLeft As Integer
    cInfo As Integer
End Type
Private cArray() As cInfo
Private Count As Integer

Private FormHeight As Integer
Private FormWidth As Integer

Public Property Let hParam(ByVal fh As Integer)
    FormHeight = fh
        
End Property
Public Property Let wParam(ByVal fw As Integer)
    FormWidth = fw
End Property
Public Sub Map(rCont As Control, SizeInfo As eParams)
    Count = Count + 1
    ReDim Preserve cArray(Count)
    Set cArray(Count).cControl = rCont
    cArray(Count).cInfo = SizeInfo
    
    Select Case SizeInfo
        Case 1:
            cArray(Count).cTop = FormHeight - rCont.Top
        Case 2:
            cArray(Count).cLeft = FormWidth - rCont.Left
        Case 3:
            cArray(Count).cTop = FormHeight - rCont.Top
            cArray(Count).cLeft = FormWidth - rCont.Left
        Case 4:
            cArray(Count).cHeight = FormHeight - rCont.Height
        Case 5:
            cArray(Count).cWidth = FormWidth - rCont.Width
        Case 6:
            cArray(Count).cHeight = FormHeight - rCont.Height
            cArray(Count).cWidth = FormWidth - rCont.Width
        Case Else:
            Exit Sub
    End Select
    
End Sub

Public Sub rSize(cForm As Form)
    On Error Resume Next
    Dim i As Integer
    For i = 1 To Count
        Select Case cArray(i).cInfo
            Case 1:
                cArray(i).cControl.Top = cForm.Height - cArray(i).cTop
            Case 2:
                cArray(i).cControl.Left = cForm.Width - cArray(i).cLeft
            Case 3:
                cArray(i).cControl.Top = cForm.Height - cArray(i).cTop
                cArray(i).cControl.Left = cForm.Width - cArray(i).cLeft
            Case 4:
                cArray(i).cControl.Height = cForm.Height - cArray(i).cHeight
            Case 5:
                cArray(i).cControl.Width = cForm.Width - cArray(i).cWidth
            Case 6:
                cArray(i).cControl.Height = cForm.Height - cArray(i).cHeight
                cArray(i).cControl.Width = cForm.Width - cArray(i).cWidth
            
                
        End Select
    Next
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -