1
1

Toolbar.bas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. '// This is free and unencumbered software released into the public domain.
  2. '// For more information, please refer to https://github.com/hongwenjun
  3. Private Const Github_Version = 1
  4. #If VBA7 Then
  5. 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
  6. Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
  7. Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  8. Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  9. Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  10. Private Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  11. Private Declare PtrSafe Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  12. #Else
  13. 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
  14. Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
  15. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  16. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  17. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  18. Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  19. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  20. #End If
  21. Private Const GWL_STYLE As Long = (-16)
  22. Private Const GWL_EXSTYLE = (-20)
  23. Private Const WS_CAPTION As Long = &HC00000
  24. Private Const WS_EX_DLGMODALFRAME = &H1&
  25. 'Constants for transparency
  26. Private Const WS_EX_LAYERED = &H80000
  27. Private Const LWA_COLORKEY = &H1 'Chroma key for fading a certain color on your Form
  28. Private Const LWA_ALPHA = &H2 'Only needed if you want to fade the entire userform
  29. Public UIL_Key As Boolean
  30. Public pic1, pic2
  31. Private Sub MakeUserFormTransparent(frm As Object, Optional Color As Variant)
  32. 'set transparencies on userform
  33. Dim formhandle As Long
  34. Dim bytOpacity As Byte
  35. formhandle = FindWindow(vbNullString, Me.Caption)
  36. If IsMissing(Color) Then Color = vbWhite 'default to vbwhite
  37. bytOpacity = 100 ' variable keeping opacity setting
  38. SetWindowLong formhandle, GWL_EXSTYLE, GetWindowLong(formhandle, GWL_EXSTYLE) Or WS_EX_LAYERED
  39. 'The following line makes only a certain color transparent so the
  40. ' background of the form and any object whose BackColor you've set to match
  41. ' vbColor (default vbWhite) will be transparent.
  42. Me.BackColor = Color
  43. SetLayeredWindowAttributes formhandle, Color, bytOpacity, LWA_COLORKEY
  44. End Sub
  45. Private Sub Change_UI_Close_Voice_Click()
  46. SaveSetting "LYVBA", "Settings", "SpeakHelp", "0"
  47. MsgBox "请给我支持!" & vbNewLine & "您的支持,我才能有动力添加更多功能." & vbNewLine & "蘭雅CorelVBA工具 永久免费开源"
  48. End Sub
  49. Private Sub I18N_LNG_Click()
  50. LNG_CODE = Val(GetSetting("LYVBA", "Settings", "I18N_LNG", "1033"))
  51. If LNG_CODE = 1033 Then
  52. LNG_CODE = 2052
  53. Else
  54. LNG_CODE = 1033
  55. End If
  56. SaveSetting "LYVBA", "Settings", "I18N_LNG", LNG_CODE
  57. MsgBox "中英文语言切换完成,请重启插件!", vbOKOnly, "兰雅VBA代码分享"
  58. End Sub
  59. Private Sub UserForm_Initialize()
  60. Dim IStyle As Long
  61. Dim hwnd As Long
  62. hwnd = FindWindow("ThunderDFrame", Me.Caption)
  63. IStyle = GetWindowLong(hwnd, GWL_STYLE)
  64. IStyle = IStyle And Not WS_CAPTION
  65. SetWindowLong hwnd, GWL_STYLE, IStyle
  66. DrawMenuBar hwnd
  67. IStyle = GetWindowLong(hwnd, GWL_EXSTYLE) And Not WS_EX_DLGMODALFRAME
  68. SetWindowLong hwnd, GWL_EXSTYLE, IStyle
  69. With Me
  70. .StartUpPosition = 0
  71. .Left = Val(GetSetting("LYVBA", "Settings", "Left", "400")) ' 设置工具栏位置
  72. .Top = Val(GetSetting("LYVBA", "Settings", "Top", "55"))
  73. .Height = 30
  74. .width = 336
  75. End With
  76. OutlineKey = True
  77. OptKey = True
  78. ' 读取角线设置
  79. Bleed.text = API.GetSet("Bleed")
  80. Line_len.text = API.GetSet("Line_len")
  81. Outline_Width.text = GetSetting("LYVBA", "Settings", "Outline_Width", "0.2")
  82. UIFile = Path & "GMS\LYVBA\" & HDPI.GetHDPIPercentage & "\ToolBar.jpg"
  83. If API.ExistsFile_UseFso(UIFile) Then
  84. UI.Picture = LoadPicture(UIFile) '换UI图
  85. Set pic1 = LoadPicture(UIFile)
  86. End If
  87. UIL = Path & "GMS\LYVBA\ToolBar1.jpg"
  88. If API.ExistsFile_UseFso(UIL) Then
  89. Set pic2 = LoadPicture(UIL)
  90. UIL_Key = True
  91. End If
  92. ' 窗口透明, 最小化只显示一个图标
  93. #If VBA7 Then
  94. MakeUserFormTransparent Me, RGB(26, 22, 35)
  95. #Else
  96. ' CorelDRAW X4 / Windows7 自用关闭透明
  97. #End If
  98. End Sub
  99. Private Sub UI_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  100. UI.Visible = False
  101. If Y > 1 And Y < 16 And UIL_Key Then
  102. UI.Picture = pic2
  103. ElseIf Y > 16 And UIL_Key Then
  104. UI.Picture = pic1
  105. End If
  106. UI.Visible = True
  107. ' Debug.Print X & " , " & Y
  108. End Sub
  109. Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  110. If Button Then
  111. mx = X: my = Y
  112. End If
  113. With Me
  114. .Height = 30
  115. End With
  116. End Sub
  117. Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  118. If Button Then
  119. Me.Left = Me.Left - mx + X
  120. Me.Top = Me.Top - my + Y
  121. End If
  122. End Sub
  123. Private Sub LOGO_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  124. If Abs(X - 14) < 14 And Abs(Y - 14) < 14 And Button = 2 Then
  125. Me.width = 336
  126. OPEN_UI_BIG.Left = 322
  127. UI.Visible = True
  128. LOGO.Visible = False
  129. TOP_ALIGN_BT.Visible = False
  130. LEFT_ALIGN_BT.Visible = False
  131. Exit Sub
  132. ElseIf Shift = fmCtrlMask Then
  133. mx = X: my = Y
  134. Else
  135. Unload Me ' Ctrl + 鼠标 关闭工具
  136. End If
  137. End Sub
  138. Private Sub LOGO_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  139. If Button Then
  140. Me.Left = Me.Left - mx + X
  141. Me.Top = Me.Top - my + Y
  142. End If
  143. End Sub
  144. Private Sub UI_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  145. Dim c As New Color
  146. ' 定义图标坐标pos
  147. Dim pos_x As Variant, pos_y As Variant
  148. pos_y = Array(14)
  149. pos_x = Array(14, 41, 67, 94, 121, 148, 174, 201, 228, 254, 281, 308, 334, 361, 388, 415, 441, 468, 495)
  150. '// 按下Ctrl键,最优先处理工具功能
  151. If Shift = 2 Then
  152. If Abs(X - pos_x(0)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  153. '// 安全线,清除辅助线
  154. Tools.guideangle ActiveSelectionRange, 3 ' 左键 3mm 出血
  155. ElseIf Abs(X - pos_x(1)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  156. '// Adobe AI EPS INDD PDF和CorelDRAW 缩略图工具
  157. AdobeThumbnail_Click
  158. ElseIf Abs(X - pos_x(2)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  159. '// 多物件拆分线段
  160. Tools.Split_Segment
  161. ElseIf Abs(X - pos_x(3)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  162. '// 智能拆字
  163. Tools.Take_Apart_Character
  164. ElseIf Abs(X - pos_x(4)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  165. '// 暂时空
  166. ElseIf Abs(X - pos_x(5)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  167. '// 暂时空
  168. ElseIf Abs(X - pos_x(6)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  169. '// 木头人智能群组,异形群组
  170. autogroup("group", 1).CreateSelection
  171. ElseIf Abs(X - pos_x(8)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  172. '// CTRL扩展工具栏
  173. Me.Height = 30 + 45
  174. ElseIf Abs(X - pos_x(9)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  175. ' 文本转曲 参数 all=1 ,支持框选和图框剪裁内的文本
  176. ' Tools.TextShape_ConvertToCurves 1
  177. End If
  178. Exit Sub
  179. End If
  180. '// 鼠标右键 扩展键按钮优先 收缩工具栏 标记范围框 居中页面 尺寸取整数 单色黑中线标记 扩展工具栏 排列工具 扩展工具栏收缩
  181. If Button = 2 Then
  182. If Abs(X - pos_x(0)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  183. '// 收缩工具栏
  184. Me.width = 30: Me.Height = 30
  185. UI.Visible = False: LOGO.Visible = True
  186. ElseIf Abs(X - pos_x(1)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  187. '// 居中页面
  188. Tools.Align_Page_Center
  189. ElseIf Abs(X - pos_x(2)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  190. If Github_Version = 1 Then
  191. '// 单线条转裁切线 - 放置到页面四边
  192. CutLines.SelectLine_to_Cropline
  193. Else
  194. '// 标记范围框
  195. Tools.Mark_Range_Box
  196. End If
  197. ElseIf Abs(X - pos_x(3)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  198. '// 批量设置物件尺寸整数
  199. Tools.Size_to_Integer
  200. '//分分合合把几个功能按键合并到一起,定义到右键上
  201. ElseIf Abs(X - pos_x(4)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  202. '// Tools.分分合合
  203. ElseIf Abs(X - pos_x(5)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  204. '// 自动中线色阶条 黑白
  205. AutoColorMark.Auto_ColorMark_K
  206. ElseIf Abs(X - pos_x(6)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  207. '// 智能群组
  208. SmartGroup.Smart_Group API.Create_Tolerance
  209. ElseIf Abs(X - pos_x(7)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  210. If Github_Version = 1 Then
  211. CQL_FIND_UI.Show 0
  212. Else
  213. '// 选择相同工具增强版
  214. frmSelectSame.Show 0
  215. End If
  216. ElseIf Abs(X - pos_x(8)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  217. '// 右键扩展工具栏
  218. Me.Height = 30 + 45
  219. ElseIf Abs(X - pos_x(9)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  220. '// 文本统计信息
  221. Application.FrameWork.Automation.InvokeItem "bf3bd8fe-ca26-4fe0-91b0-3b5c99786fb6"
  222. ElseIf Abs(X - pos_x(10)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  223. '// 右键排列工具
  224. TOP_ALIGN_BT.Visible = True
  225. LEFT_ALIGN_BT.Visible = True
  226. ElseIf Abs(X - pos_x(11)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  227. '// 右键扩展工具栏收缩
  228. Me.Height = 30
  229. End If
  230. Exit Sub
  231. End If
  232. '// 鼠标左键 单击按钮功能 按工具栏上图标正常功能
  233. If Abs(X - pos_x(0)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  234. '// 裁切线: 批量物件裁切线
  235. CutLines.Batch_CutLines
  236. ElseIf Abs(X - pos_x(1)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  237. '// 剪贴板尺寸建立矩形
  238. ClipbRectangle.Build_Rectangle
  239. ElseIf Abs(X - pos_x(2)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  240. If Github_Version = 1 Then
  241. MakeSizePlus.Show 0
  242. Else
  243. '// 单线条转裁切线 - 放置到页面四边
  244. CutLines.SelectLine_to_Cropline
  245. End If
  246. ElseIf Abs(X - pos_x(3)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  247. '// 拼版.Arrange
  248. Arrange.Arrange
  249. ElseIf Abs(X - pos_x(4)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  250. '// 拼版裁切线
  251. CutLines.Draw_Lines
  252. ElseIf Abs(X - pos_x(5)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  253. '// 自动中线色阶条 彩色
  254. AutoColorMark.Auto_ColorMark
  255. ElseIf Abs(X - pos_x(6)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  256. '// 智能群组 没容差
  257. SmartGroup.Smart_Group
  258. ElseIf Abs(X - pos_x(7)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  259. If Github_Version = 1 Then
  260. '// 选择相同工具增强版
  261. frmSelectSame.Show 0
  262. Else
  263. CQL_FIND_UI.Show 0
  264. End If
  265. ElseIf Abs(X - pos_x(8)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  266. Replace_UI.Show 0
  267. ElseIf Abs(X - pos_x(9)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  268. ' 简单文本转曲
  269. Tools.TextShape_ConvertToCurves 0
  270. ElseIf Abs(X - pos_x(10)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  271. '// 扩展工具栏
  272. Me.Height = 30 + 45
  273. Speak_Msg "左右键有不同功能"
  274. ElseIf Abs(X - pos_x(11)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  275. If Me.Height > 30 Then
  276. Me.Height = 30
  277. Else
  278. '// 最小化
  279. Me.width = 30
  280. Me.Height = 30
  281. OPEN_UI_BIG.Left = 31
  282. UI.Visible = False
  283. LOGO.Visible = True
  284. ' 保存工具条位置 Left 和 Top
  285. SaveSetting "LYVBA", "Settings", "Left", Me.Left
  286. SaveSetting "LYVBA", "Settings", "Top", Me.Top
  287. Speak_Msg "左键缩小 右键收缩"
  288. End If
  289. End If
  290. End Sub
  291. Private Sub X_EXIT_Click()
  292. Unload Me ' 关闭
  293. End Sub
  294. '// 多页合并工具,已经合并到主线工具
  295. ' Private Sub 调用多页合并工具()
  296. ' Dim value As Integer
  297. ' value = GMSManager.RunMacro("合并多页工具", "合并多页运行.run")
  298. ' End Sub
  299. '''/// 贪心商人和好玩工具等 ///'''
  300. Private Sub Cdr_Nodes_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  301. If Button = 2 Then
  302. TSP.Nodes_To_TSP
  303. ElseIf Shift = fmCtrlMask Then
  304. TSP.CDR_TO_TSP
  305. Else
  306. ' Ctrl + 鼠标 空
  307. End If
  308. End Sub
  309. Private Sub Cdr_Nodes_BT_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  310. TSP_L1.ForeColor = RGB(0, 150, 255)
  311. End Sub
  312. Private Sub START_TSP_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  313. TSP_L2.ForeColor = RGB(0, 150, 255)
  314. End Sub
  315. Private Sub PATH_TO_TSP_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  316. TSP_L3.ForeColor = RGB(0, 150, 255)
  317. End Sub
  318. Private Sub TSP2DRAW_LINE_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  319. TSP_L4.ForeColor = RGB(0, 150, 255)
  320. End Sub
  321. Private Sub TSP2DRAW_LINE_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  322. If Button = 2 Then
  323. TSP.TSP_TO_DRAW_LINE
  324. ElseIf Shift = fmCtrlMask Then
  325. TSP.TSP_TO_DRAW_LINES
  326. Else
  327. ' Ctrl + 鼠标 空
  328. End If
  329. End Sub
  330. Private Sub START_TSP_Click()
  331. TSP.START_TSP
  332. End Sub
  333. Private Sub PATH_TO_TSP_Click()
  334. TSP.MAKE_TSP
  335. End Sub
  336. Private Sub BITMAP_BUILD_Click()
  337. Tools.Python_BITMAP
  338. End Sub
  339. Private Sub BITMAP_BUILD2_Click()
  340. Tools.Python_BITMAP2
  341. End Sub
  342. Private Sub BITMAP_MAKE_DOTS_Click()
  343. TSP.BITMAP_MAKE_DOTS
  344. End Sub
  345. '''/// Python脚本和二维码等 ///'''
  346. Private Sub Organize_Size_Click()
  347. Tools.Python_Organize_Size
  348. End Sub
  349. Private Sub Get_Number_Click()
  350. Tools.Python_Get_Barcode_Number
  351. End Sub
  352. Private Sub Make_QRCode_Click()
  353. Tools.Python_Make_QRCode
  354. Tools.QRCode_replace
  355. End Sub
  356. Private Sub QR2Vector_Click()
  357. Tools.QRCode_to_Vector
  358. End Sub
  359. Private Sub OPEN_UI_BIG_Click()
  360. Unload Me
  361. MsgBox "请给我支持!" & vbNewLine & "您的支持,我才能有动力添加更多功能." & vbNewLine & "蘭雅CorelVBA工具 永久免费开源" _
  362. & vbNewLine & "源码网址:" & vbNewLine & "https://github.com/hongwenjun/corelvba"
  363. End Sub
  364. Private Sub Settings_Click()
  365. If 0 < Val(Bleed.text) * Val(Line_len.text) < 100 Then
  366. SaveSetting "LYVBA", "Settings", "Bleed", Bleed.text
  367. SaveSetting "LYVBA", "Settings", "Line_len", Line_len.text
  368. SaveSetting "LYVBA", "Settings", "Outline_Width", Outline_Width.text
  369. End If
  370. ' 保存工具条位置 Left 和 Top
  371. SaveSetting "LYVBA", "Settings", "Left", Me.Left
  372. SaveSetting "LYVBA", "Settings", "Top", Me.Top
  373. Me.Height = 30
  374. End Sub
  375. '''///////// 图标鼠标左右点击功能调用 /////////'''
  376. Private Sub Tools_Icon_Click()
  377. ' 调用语句
  378. i = GMSManager.RunMacro("ZeroBase", "Hello_VBA.run")
  379. End Sub
  380. Private Sub Split_Segment_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  381. If Button = 2 Then
  382. MsgBox "左键拆分线段,Ctrl合并线段"
  383. ElseIf Shift = fmCtrlMask Then
  384. Tools.Split_Segment
  385. Else
  386. ActiveSelection.CustomCommand "ConvertTo", "JoinCurves"
  387. Application.Refresh
  388. End If
  389. Speak_Msg "拆分线段,Ctrl合并线段"
  390. End Sub
  391. '''//// CorelDRAW 与 Adobe_Illustrator 剪贴板转换 ////'''
  392. Private Sub Adobe_Illustrator_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  393. Dim value As Integer
  394. If Button = 2 Then
  395. value = GMSManager.RunMacro("AIClipboard", "CopyPaste.PasteAIFormat")
  396. Exit Sub
  397. End If
  398. If Button Then
  399. value = GMSManager.RunMacro("AIClipboard", "CopyPaste.CopyAIFormat")
  400. MsgBox "CorelDRAW 与 Adobe_Illustrator 剪贴板转换" & vbNewLine & "鼠标左键复制,鼠标右键粘贴"
  401. End If
  402. End Sub
  403. '''//// 标记画框 支持容差 ////'''
  404. Private Sub Mark_CreateRectangle_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  405. If Button = 2 Then
  406. Tools.Mark_CreateRectangle True
  407. ElseIf Shift = fmCtrlMask Then
  408. Tools.Mark_CreateRectangle False
  409. Else
  410. Create_Tolerance
  411. End If
  412. Speak_Msg "标记画框 右键支持容差"
  413. End Sub
  414. '''//// 一键拆开多行组合的文字字符 ////'''
  415. Private Sub Batch_Combine_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  416. If Button = 2 Then
  417. Tools.Batch_Combine
  418. ElseIf Shift = fmCtrlMask Then
  419. Tools.Take_Apart_Character
  420. Else
  421. Create_Tolerance
  422. End If
  423. End Sub
  424. '''//// 简单一刀切 ////'''
  425. Private Sub Single_Line_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  426. If Button = 2 Then
  427. Tools.Single_Line_Vertical
  428. ElseIf Shift = fmCtrlMask Then
  429. Tools.Single_Line
  430. Else
  431. Tools.Single_Line_LastNode
  432. End If
  433. End Sub
  434. '''//// 傻瓜火车排列 ////'''
  435. Private Sub TOP_ALIGN_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  436. If Button = 2 Then
  437. Tools.Simple_Train_Arrangement 3#
  438. ElseIf Shift = fmCtrlMask Then
  439. Tools.Simple_Train_Arrangement 0#
  440. Else
  441. Tools.Simple_Train_Arrangement Set_Space_Width
  442. End If
  443. End Sub
  444. '''//// 傻瓜阶梯排列 ////'''
  445. Private Sub LEFT_ALIGN_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  446. If Button = 2 Then
  447. Tools.Simple_Ladder_Arrangement 3#
  448. ElseIf Shift = fmCtrlMask Then
  449. Tools.Simple_Ladder_Arrangement 0#
  450. Else
  451. Tools.Simple_Ladder_Arrangement Set_Space_Width
  452. End If
  453. End Sub
  454. '''//// 左键-多页合并一页工具 右键-批量多页居中 ////'''
  455. Private Sub UniteOne_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  456. If Button = 2 Then
  457. Tools.Batch_Align_Page_Center
  458. ElseIf Shift = fmCtrlMask Then
  459. UniteOne.Show 0
  460. Else
  461. ' Ctrl + 鼠标 空
  462. End If
  463. End Sub
  464. '''//// Adobe AI EPS INDD PDF和CorelDRAW 缩略图工具 ////'''
  465. Private Sub AdobeThumbnail_Click()
  466. Dim h As Long, r As Long
  467. mypath = Path & "GMS\LYVBA\"
  468. App = mypath & "GuiAdobeThumbnail.exe"
  469. h = FindWindow(vbNullString, "CorelVBA 青年节 By 蘭雅sRGB")
  470. i = ShellExecute(h, "", App, "", mypath, 1)
  471. End Sub
  472. '''//// 快速颜色选择 ////'''
  473. Private Sub Quick_Color_Select_Click()
  474. Tools.quickColorSelect
  475. End Sub
  476. Private Sub Cut_Cake_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  477. If Button = 2 Then
  478. Tools.divideVertically
  479. ElseIf Shift = fmCtrlMask Then
  480. Tools.divideHorizontally
  481. Else
  482. ' Ctrl + 鼠标 空
  483. End If
  484. End Sub
  485. '// 安全辅助线功能,三键控制,讨厌辅助线的也可以用来删除辅助线
  486. Private Sub Safe_Guideangle_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  487. If Button = 2 Then
  488. Tools.guideangle ActiveSelectionRange, 0# ' 右键0距离贴紧
  489. ElseIf Shift = fmCtrlMask Then
  490. Tools.guideangle ActiveSelectionRange, 3 ' 左键 3mm 出血
  491. Else
  492. Tools.guideangle ActiveSelectionRange, -Set_Space_Width ' Ctrl + 鼠标左键 自定义间隔
  493. End If
  494. End Sub
  495. '// 标准尺寸,左键右键Ctrl三键控制,调用三种样式
  496. Private Sub btn_makesizes_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  497. If Button = 2 Then
  498. Make_SIZE.Show 0 ' 右键
  499. ElseIf Shift = fmCtrlMask Then
  500. #If VBA7 Then
  501. MakeSizePlus.Show 0
  502. #Else ' X4 使用
  503. Make_SIZE.Show 0
  504. #End If
  505. Else
  506. Tools.Simple_Label_Numbers ' Ctrl + 鼠标 批量简单数字标注
  507. End If
  508. End Sub
  509. '// 批量转图片和导出图片文件
  510. Private Sub Photo_Form_Click()
  511. PhotoForm.Show 0
  512. End Sub
  513. '// 修复圆角缺角到直角
  514. Private Sub btn_corners_off_Click()
  515. Tools.corner_off
  516. End Sub
  517. Private Sub SortCount_Click()
  518. Tools.Count_byArea 30
  519. End Sub
  520. Private Sub LevelRuler_Click()
  521. Tools.Angle_to_Horizon
  522. End Sub
  523. Private Sub MirrorLine_Click()
  524. Tools.Mirror_ByGuide
  525. End Sub
  526. Private Sub AutoRotate_Click()
  527. Tools.Auto_Rotation_Angle
  528. End Sub
  529. Private Sub SwapShape_Click()
  530. Tools.Exchange_Object
  531. End Sub
  532. '// 小工具快速启动
  533. Private Sub Open_Calc_Click()
  534. Launcher.START_Calc
  535. End Sub
  536. Private Sub Open_Notepad_Click()
  537. Launcher.START_Notepad
  538. End Sub
  539. Private Sub ImageReader_Click()
  540. Launcher.START_Barcode_ImageReader
  541. End Sub
  542. Private Sub Video_Camera_Click()
  543. Launcher.START_Bandicam
  544. End Sub
  545. Private Sub myfonts_Click()
  546. Launcher.START_whatthefont
  547. End Sub
  548. Private Sub VectorMagic_Click()
  549. Launcher.START_Vector_Magic
  550. End Sub
  551. Private Sub waifu2x_Click()
  552. Launcher.START_waifu2x
  553. End Sub