CorelVBA.bas 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. VERSION 5.00
  2. Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} CorelVBA
  3. Caption = "CorelVBA 中秋节版 By 蘭雅sRGB 2022"
  4. ClientHeight = 5415
  5. ClientLeft = 45
  6. ClientTop = 330
  7. ClientWidth = 7740
  8. OleObjectBlob = "CorelVBA.frx":0000
  9. StartUpPosition = 1 '所有者中心
  10. End
  11. Attribute VB_Name = "CorelVBA"
  12. Attribute VB_GlobalNameSpace = False
  13. Attribute VB_Creatable = False
  14. Attribute VB_PredeclaredId = True
  15. Attribute VB_Exposed = False
  16. #If VBA7 Then
  17. Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal Hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  18. Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal Hwnd As Long) As Long
  19. Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long) As Long
  20. Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  21. Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  22. Private Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  23. #Else
  24. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal Hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  25. Private Declare Function DrawMenuBar Lib "user32" (ByVal Hwnd As Long) As Long
  26. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long) As Long
  27. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  28. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  29. Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  30. #End If
  31. Private Const GWL_STYLE As Long = (-16)
  32. Private Const GWL_EXSTYLE = (-20)
  33. Private Const WS_CAPTION As Long = &HC00000
  34. Private Const WS_EX_DLGMODALFRAME = &H1&
  35. Private switch As Boolean
  36. Private Sub Close_Icon_Click()
  37. Unload Me ' 关闭
  38. End Sub
  39. Private Sub ToolBar_show_Click()
  40. Unload Me
  41. Toolbar.Show 0
  42. End Sub
  43. Private Sub UserForm_Initialize()
  44. Dim IStyle As Long
  45. Dim Hwnd As Long
  46. Hwnd = FindWindow("ThunderDFrame", Me.Caption)
  47. IStyle = GetWindowLong(Hwnd, GWL_STYLE)
  48. IStyle = IStyle And Not WS_CAPTION
  49. SetWindowLong Hwnd, GWL_STYLE, IStyle
  50. DrawMenuBar Hwnd
  51. IStyle = GetWindowLong(Hwnd, GWL_EXSTYLE) And Not WS_EX_DLGMODALFRAME
  52. SetWindowLong Hwnd, GWL_EXSTYLE, IStyle
  53. With Me
  54. ' .StartUpPosition = 0
  55. ' .Left = 500
  56. ' .Top = 200
  57. .Width = 385.5
  58. .Height = 271.45
  59. End With
  60. UIFile = Path & "GMS\262235.xyz\UI.jpg"
  61. If API.ExistsFile_UseFso(UIFile) Then
  62. UI.Picture = LoadPicture(UIFile) '换UI图
  63. End If
  64. End Sub
  65. Private Sub LOGO_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  66. If Button Then
  67. mx = x
  68. my = y
  69. End If
  70. End Sub
  71. Private Sub LOGO_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  72. If Button Then
  73. Me.Left = Me.Left - mx + x
  74. Me.Top = Me.Top - my + y
  75. End If
  76. End Sub
  77. Private Sub About_Cmd_Click()
  78. MsgBox "请给我支持!" & vbNewLine & "您的支持,我才能有动力添加更多功能." & vbNewLine & "蘭雅CorelVBA中秋节版" & vbNewLine & "coreldrawvba插件交流群 8531411"
  79. End Sub
  80. Private Sub UI_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  81. ' 定义图标坐标pos
  82. Dim pos_x As Variant
  83. Dim pos_y As Variant
  84. pos_x = Array(32, 110, 186, 265, 345)
  85. pos_y = Array(50, 135, 215)
  86. If Abs(x - pos_x(0)) < 30 And Abs(y - pos_y(0)) < 30 Then
  87. 物件角线
  88. ElseIf Abs(x - pos_x(1)) < 30 And Abs(y - pos_y(0)) < 30 Then
  89. 绘制矩形
  90. ElseIf Abs(x - pos_x(2)) < 30 And Abs(y - pos_y(0)) < 30 Then
  91. 角线爬虫
  92. ElseIf Abs(x - pos_x(3)) < 30 And Abs(y - pos_y(0)) < 30 Then
  93. 矩形拼版
  94. ElseIf Abs(x - pos_x(4)) < 30 And Abs(y - pos_y(0)) < 30 Then
  95. 拼版角线
  96. End If
  97. If Abs(x - pos_x(0)) < 30 And Abs(y - pos_y(1)) < 30 Then
  98. Tools.居中页面
  99. ElseIf Abs(x - pos_x(1)) < 30 And Abs(y - pos_y(1)) < 30 Then
  100. 拼版标记
  101. ElseIf Abs(x - pos_x(2)) < 30 And Abs(y - pos_y(1)) < 30 Then
  102. 智能群组
  103. ElseIf Abs(x - pos_x(3)) < 30 And Abs(y - pos_y(1)) < 30 Then
  104. CQL选择
  105. ElseIf Abs(x - pos_x(4)) < 30 And Abs(y - pos_y(1)) < 30 Then
  106. 批量替换
  107. End If
  108. If Abs(x - pos_x(0)) < 30 And Abs(y - pos_y(2)) < 30 Then
  109. Tools.尺寸取整
  110. ElseIf Abs(x - pos_x(1)) < 30 And Abs(y - pos_y(2)) < 30 Then
  111. Tools.TextShape_ConvertToCurves
  112. ElseIf Abs(x - pos_x(2)) < 30 And Abs(y - pos_y(2)) < 30 Then
  113. Dim h As Long, r As Long
  114. mypath = Path & "GMS\262235.xyz\"
  115. app = mypath & "GuiAdobeThumbnail.exe"
  116. h = FindWindow(vbNullString, "CorelVBA 青年节 By 蘭雅sRGB")
  117. i = ShellExecute(h, "", app, "", mypath, 1)
  118. ElseIf Abs(x - pos_x(3)) < 30 And Abs(y - pos_y(2)) < 30 Then
  119. If switch Then
  120. switch = Not switch
  121. Tools.傻瓜火车排列 0#
  122. Else
  123. switch = Not switch
  124. Tools.傻瓜阶梯排列 0#
  125. End If
  126. ElseIf Abs(x - pos_x(4)) < 30 And Abs(y - pos_y(2)) < 30 Then
  127. 学习CorelVBA实验室
  128. End If
  129. If Abs(x - 210) < 30 And Abs(y - 261) < 8 Then
  130. WebHelp "https://262235.xyz/index.php/tag/vba/"
  131. End If
  132. End Sub
  133. Function WebHelp(url As String)
  134. Dim h As Long, r As Long
  135. h = FindWindow(vbNullString, "CorelVBA 青年节 By 蘭雅sRGB")
  136. r = ShellExecute(h, "", url, "", "", 1)
  137. End Function
  138. Private Sub 绘制矩形()
  139. 剪贴板尺寸建立矩形.start
  140. End Sub
  141. Private Sub 角线爬虫()
  142. 裁切线.SelectLine_to_Cropline
  143. End Sub
  144. Private Sub 矩形拼版()
  145. 拼版裁切线.arrange
  146. End Sub
  147. Private Sub 批量替换()
  148. CorelVBA.Hide
  149. Replace_UI.Show 0
  150. End Sub
  151. Private Sub 拼版标记()
  152. 自动中线色阶条.Auto_ColorMark
  153. End Sub
  154. Private Sub 拼版角线()
  155. 拼版裁切线.Cut_lines
  156. End Sub
  157. Private Sub 物件角线()
  158. 裁切线.start
  159. End Sub
  160. Private Sub 智能群组()
  161. 智能群组和查找.智能群组
  162. End Sub
  163. Private Sub CQL选择()
  164. CorelVBA.Hide
  165. CQL_FIND_UI.Show 0
  166. End Sub
  167. Private Sub 学习CorelVBA实验室()
  168. CorelVBA.Hide
  169. ' 调用语句
  170. i = GMSManager.RunMacro("CorelDRAW_VBA", "学习CorelVBA.start")
  171. End Sub