ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Userform³Ì¤j¤Æ(¥B¤º®e¤ñ¨Ò¦Û°Ê©ñ¤j?)

ÁÙ¦³¤@­Ó¤èªk, ´N¬O¤£­n¥Î ZOOM , §ï¦¨¦Û¤vÁY©ñ

TOP

¥»©«³Ì«á¥Ñ bobomi ©ó 2015-5-17 14:30 ½s¿è

§ï¦¨¤U­±ªº code  (¦³µo²{°ÝÃD¦b­þ¤F)
¬Ý¬Ýµ§¹qªº13"¿Ã¹õ°ÝÃD¬O§_§ïµ½
========================
Dim Form_First_wh
Dim Form_Last_wh
Dim UserForm1_BarHeight

   
    Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    Private Declare Function SetActiveWindow Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const GWL_STYLE = (-16)
    Private Const SW_SHOWMAXIMIZED = 3
    Private Const SW_SHOWNORMAL = 1
    Private Const SW_SHOWMINIMIZED = 2
    Private Const WS_THICKFRAME = &H40000
    Const SM_CXFULLSCREEN = 16
    Const SM_CYFULLSCREEN = 17
    Const HWND_TOPMOST = -1
    Const SWP_SHOWWINDOW = &H40
    Dim hWndForm As Long
    Dim IStyle As Long


    Private Sub UserForm_Initialize()
      hWndForm = FindWindow("ThunderDFrame", Me.Caption)
      IStyle = GetWindowLong(hWndForm, GWL_STYLE)
      IStyle = IStyle Or WS_THICKFRAME
      IStyle = IStyle Or WS_MINIMIZEBOX
      IStyle = IStyle Or WS_MAXIMIZEBOX
      
      SetWindowLong hWndForm, GWL_STYLE, IStyle
      
      
      a = UserForm1.Height
      UserForm1.Height = 0
      UserForm1_BarHeight = UserForm1.Height
      UserForm1.Height = a + 1.5
      
      Form_First_wh = Array(UserForm1.Width, UserForm1.Height)
      Form_Last_wh = Form_First_wh
    End Sub

    Public Sub myShowMax()
        SetActiveWindow hWndForm
        ShowWindow hWndForm, SW_SHOWMAXIMIZED
    End Sub

Private Sub UserForm_Resize()
If Not IsArray(Form_First_wh) Then Exit Sub
' If (Form_First_wh(1) - UserForm1.Height) * (Form_First_wh(0) - UserForm1.Width) < 0 Then
'     MsgBox "UserForm1.Zoom µLªk¤ä´©µøµ¡¤@Ãä©ñ¤j, ¥t¤@Ãä«oÁY¤p"
'     UserForm1.Move UserForm1.Left, UserForm1.Top, Form_Last_wh(0), Form_Last_wh(1)
'     Exit Sub
' End If

On Error Resume Next
If Abs(Form_First_wh(1) - UserForm1.Height) > Abs(Form_First_wh(0) - UserForm1.Width) Then
     UserForm1.Width = (UserForm1.Height - UserForm1_BarHeight) / (Form_First_wh(1) - UserForm1_BarHeight) * Form_First_wh(0)
Else
    UserForm1.Height = UserForm1.Width / Form_First_wh(0) * (Form_First_wh(1) - UserForm1_BarHeight) + UserForm1_BarHeight
   'UserForm1.Height = UserForm1.Width / Form_First_wh(0) * Form_First_wh(1)
End If
On Error GoTo 0

   Form_Last_wh = Array(UserForm1.Width, UserForm1.Height)
On Error Resume Next
UserForm1.Zoom = (UserForm1.Height - UserForm1_BarHeight) / (Form_First_wh(1) - UserForm1_BarHeight) * 100
End Sub

TOP

¦pªGÁÙ¬O¤£¦æ
§â UserForm1 ªºµ{¦¡½X§R¥ú(¥u¯d±±¨î¶µ´N¥i¥H¤F )
µM«á¶×¥X UserForm1  -> ¤W¶Ç UserForm1.frm
§Ú¦A©Ô©Ô¬Ý¬°¦ó¤£¦æ

TOP

¥»©«³Ì«á¥Ñ bobomi ©ó 2015-5-17 12:04 ½s¿è

§Ú®³¨ì13¦Tµ§¹q¸Õ
¤ñ¨Ò¦n¹³ok­C
¦ý¬Oµ§¹q¦³¶}µøı¯S®Ä
¤~µo²{§Úªº¼gªk·|¦]¬°µøı¯S®Ä¤@ª½¨ê·s¿Ã¹õ
¾É­P UserForm1 ¥X²{Ÿ§Ý ( ®à¾÷¨S¶}µøı¯S®Ä , ¤£·|¦³³o°ÝÃD )

©Ò¥H§A§ï¦¨³o¼Ë¬Ý¬Ý
¤£¥h­×§ïUserForm1 ¼e°ª, ¨Ï¨ä¦Û¥Ñ«×³Ì¤j
¦ý¯ÊÂI§A©Ô©Ô¬Ý´Nª¾¹D¤F
³o°ÝÃD¥X¦b  ZOOM ¼e°ª¥u¯à¦P©ñ¤j©ÎÁY¤p, ¤£¯à¤@Ãä©ñ¤j¥t¤@ÃäÁY¤p
¤£µM code ¥u­n2¦æ´N¸Ñ¨M¤F

(1)
Private Sub UserForm_Resize()
On Error Resume Next
UserForm1.Zoom = UserForm1.Height / Form_First_wh(1) * 100
End Sub
(2)
Private Sub UserForm_Resize()
On Error Resume Next
UserForm1.Zoom = UserForm1.Width / Form_First_wh(0) * 100
End Sub
(1) (2) ¤À§O´ú¸Õ¤@¤U, ¬Ý¬Ý­þ­Ó¤ñ¸û¾A¦X

TOP

¦^´_ 2# bobomi

¤j¤j¦n«Â~

·PÁ¦^´_,¸g´ú¸Õ«á21"¿Ã¹õ¥i¥¿±`¨Ï¥Î

¤Ï­Ë¬Oµ§¹qªº13"¿Ã¹õ·|Åܦ¨¤Ó¤j,¦³¿ìªk¨Ì·Ó¤ñ¨Ò¦Û°Ê©ñ¤j©Î¬OÁY¤p¶Ü?
PKKO

TOP

§Ú¤]²Ä¤@¦¸¥ÎZOOM
µo²{¥¦¦³¯Ê³´, ¼e°ª¥u¯à¦P©ñ¤j©ÎÁY¤p, ¤£¯à¤@Ãä©ñ¤j¥t¤@ÃäÁY¤p
¥u¦n¾E´N¥¦

// ================

Dim Form_First_wh
Dim Form_Last_wh

   
    Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    Private Declare Function SetActiveWindow Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const GWL_STYLE = (-16)
    Private Const SW_SHOWMAXIMIZED = 3
    Private Const SW_SHOWNORMAL = 1
    Private Const SW_SHOWMINIMIZED = 2
    Private Const WS_THICKFRAME = &H40000
    Const SM_CXFULLSCREEN = 16
    Const SM_CYFULLSCREEN = 17
    Const HWND_TOPMOST = -1
    Const SWP_SHOWWINDOW = &H40
    Dim hWndForm As Long
    Dim IStyle As Long




    Private Sub UserForm_Initialize()
      hWndForm = FindWindow("ThunderDFrame", Me.Caption)
      IStyle = GetWindowLong(hWndForm, GWL_STYLE)
      IStyle = IStyle Or WS_THICKFRAME
      IStyle = IStyle Or WS_MINIMIZEBOX
      IStyle = IStyle Or WS_MAXIMIZEBOX
      
      SetWindowLong hWndForm, GWL_STYLE, IStyle
      
      Form_First_wh = Array(UserForm1.Width, UserForm1.Height)
      Form_Last_wh = Form_First_wh
    End Sub

    Public Sub myShowMax()
        SetActiveWindow hWndForm
        ShowWindow hWndForm, SW_SHOWMAXIMIZED
    End Sub

Private Sub UserForm_Resize()
If (Form_First_wh(1) - UserForm1.Height) * (Form_First_wh(0) - UserForm1.Width) < 0 Then
     MsgBox "UserForm1.Zoom µLªk¤ä´©µøµ¡¤@Ãä©ñ¤j, ¥t¤@Ãä«oÁY¤p"
     UserForm1.Move UserForm1.Left, UserForm1.Top, Form_Last_wh(0), Form_Last_wh(1)
     Exit Sub
End If

On Error Resume Next
If Abs(Form_First_wh(1) - UserForm1.Height) > Abs(Form_First_wh(0) - UserForm1.Width) Then
     UserForm1.Width = UserForm1.Height / Form_First_wh(1) * Form_First_wh(0)
Else
    UserForm1.Height = UserForm1.Width / Form_First_wh(0) * Form_First_wh(1)
End If
On Error GoTo 0

   Form_Last_wh = Array(UserForm1.Width, UserForm1.Height)
UserForm1.Zoom = UserForm1.Height / Form_First_wh(1) * 100
End Sub

TOP

        ÀR«ä¦Û¦b : ¥Ç¿ù¥XÄb®¬¤ß¡A¤~¯à²M²bµL·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD