CorelVBA.bas 6.0 KB

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