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

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

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

¥»©«³Ì«á¥Ñ PKKO ©ó 2015-5-13 17:47 ½s¿è

¤p§Ì¤wª¾Userform ³Ì¤j¤Æªºµ{¦¡½X,¤]ª¾¹D¨Ì¤ñ²v©ñ¤jªºµ{¦¡½X,¦ý¤£ª¾¹D¦p¦ó¦Û°Ê¨ú±o¨âªÌ¤§¶¡ªº¤ñ²v,¨Ó¦Û°Ê³]©w©ñ¤jªº­¿¼Æ...
¦³¤Hª¾¹Dzoomªº¤ñ²v­n¦p¦ó¨D±o¶Ü?

¤ñ²vªºµ{¦¡½X
UserForm1.Zoom = 125

³Ì¤j¤Æªºµ{¦¡½X
  1. 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
  2. Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  3. Private Declare Function SetActiveWindow Lib "user32" (ByVal hwnd As Long) As Long
  4. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  5. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  6. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  7. Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
  8. Private Const WS_MAXIMIZEBOX = &H10000
  9. Private Const WS_MINIMIZEBOX = &H20000
  10. Private Const GWL_STYLE = (-16)
  11. Private Const SW_SHOWMAXIMIZED = 3
  12. Private Const SW_SHOWNORMAL = 1
  13. Private Const SW_SHOWMINIMIZED = 2
  14. Private Const WS_THICKFRAME = &H40000
  15. Const SM_CXFULLSCREEN = 16
  16. Const SM_CYFULLSCREEN = 17
  17. Const HWND_TOPMOST = -1
  18. Const SWP_SHOWWINDOW = &H40
  19. Dim hWndForm As Long
  20. Dim IStyle As Long

  21. Private Sub UserForm_Initialize()
  22.   hWndForm = FindWindow("ThunderDFrame", Me.Caption)
  23.   IStyle = GetWindowLong(hWndForm, GWL_STYLE)
  24.   IStyle = IStyle Or WS_THICKFRAME
  25.   IStyle = IStyle Or WS_MINIMIZEBOX
  26.   IStyle = IStyle Or WS_MAXIMIZEBOX
  27.   SetWindowLong hWndForm, GWL_STYLE, IStyle
  28. End Sub

  29. Public Sub myShowMax()
  30.    
  31.     SetActiveWindow hWndForm
  32.     ShowWindow hWndForm, SW_SHOWMAXIMIZED
  33. End Sub
½Æ»s¥N½X
PKKO

§Ú¤]²Ä¤@¦¸¥Î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

¦^´_ 2# bobomi

¤j¤j¦n«Â~

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

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

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

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

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

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

TOP

Zoom  ¤ñ¸û¦nªº¤è®×
22.zip (12.39 KB)

TOP

¦^´_ 8# bobomi


    ·PÁ¤j¤jªº¥Î¤ß! §Ú´ú¸Õ§¹¦A¸ò±z³ø§i !
PKKO

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2015-5-18 10:05 ½s¿è

¦^´_ 9# PKKO
¸Õ¸Õ¬Ý¦Û¤vÁY©ñ.
³oªí³æªºµ{¦¡½X
  1. Option Explicit
  2. Dim X As Double, Y As Double, e As Control
  3. Private Sub UserForm_Initialize()  'ªí³æªì©l¤Æªºµ{¦¡
  4.     Dim e As Control
  5.     X = Width
  6.     Y = Height
  7.     For Each e In Me.Controls
  8.         e.Tag = e.Top & "," & e.Left & "," & e.Width & "," & e.Height & "," & e.Font.Size
  9.     Next
  10. End Sub
  11. Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  12. 'µo¥Í¦b·í¨Ï¥ÎªÌ«ö¤F·Æ¹«Áä®É¡CMouseDown µo¥Í©ó¨Ï¥ÎªÌ«ö¤U·Æ¹«Áä****
  13.     Dim xZoom As Double
  14.     If Shift = 2 Then           'Ctrl Áä
  15.         Select Case Button      '·Æ¹«
  16.             Case 1              '«ö¤U¥ª·Æ¹«Áä¡C: ©ñ¤j
  17.                 xZoom = 1.2     '©ñ¤j %2
  18.             Case 2              '«ö¤U¥k·Æ¹«Áä¡C: ÁY¤p
  19.                 xZoom = 0.8     '©Ò¤p %2
  20.         End Select
  21.         Zoom_UserForm xZoom     'ªí³æÁY©ñµ{¦¡
  22.     ElseIf Shift = 1 Then       'Shift Áä +¥ô¤@·Æ¹««öÁä
  23.         Revert_UserForm         'ªí³æÁÙ­ì­ì¥»¤j¤p
  24.     End If
  25. End Sub
  26. Private Sub Zoom_UserForm(xZoom As Double)  'ªí³æÁY©ñ
  27.     Width = Width * xZoom
  28.     Height = Height * xZoom
  29.     For Each e In Controls
  30.         With e
  31.             .Top = .Top * xZoom
  32.             .Left = .Left * xZoom
  33.             .Width = .Width * xZoom
  34.             .Height = .Height * xZoom
  35.             .Font.Size = .Font.Size * xZoom
  36.         End With
  37.     Next
  38. End Sub
  39. Private Sub Revert_UserForm() 'ªí³æÁÙ­ì­ì¥»¤j¤p
  40.     Dim xTag As Variant
  41.     Width = X
  42.     Height = Y
  43.     For Each e In Me.Controls
  44.         With e
  45.             xTag = Split(.Tag, ",")
  46.             .Top = xTag(0)
  47.             .Left = xTag(1)
  48.             .Width = xTag(2)
  49.             .Height = xTag(3)
  50.             .Font.Size = xTag(4)
  51.         End With
  52.     Next
  53. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD