Toolbar.bas 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. VERSION 5.00
  2. Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Toolbar
  3. Caption = "Toolbar"
  4. ClientHeight = 3960
  5. ClientLeft = 45
  6. ClientTop = 330
  7. ClientWidth = 6750
  8. OleObjectBlob = "Toolbar.frx":0000
  9. End
  10. Attribute VB_Name = "Toolbar"
  11. Attribute VB_GlobalNameSpace = False
  12. Attribute VB_Creatable = False
  13. Attribute VB_PredeclaredId = True
  14. Attribute VB_Exposed = False
  15. #If VBA7 Then
  16. 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
  17. Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
  18. Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  19. Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  20. Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  21. Private Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  22. #Else
  23. 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
  24. Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
  25. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  26. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  27. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  28. Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  29. #End If
  30. Private Const GWL_STYLE As Long = (-16)
  31. Private Const GWL_EXSTYLE = (-20)
  32. Private Const WS_CAPTION As Long = &HC00000
  33. Private Const WS_EX_DLGMODALFRAME = &H1&
  34. Public UIL_Key As Boolean
  35. Public pic1, pic2
  36. Private Sub Change_UI_Close_Voice_Click()
  37. Speak_Msg "修改UI图片更换界面 注册表关闭语音 详QQ群"
  38. MsgBox "请给我支持!" & vbNewLine & "您的支持,我才能有动力添加更多功能." & vbNewLine & "蘭雅CorelVBA中秋节版" & vbNewLine & "coreldrawvba插件交流群 8531411"
  39. End Sub
  40. Private Sub UserForm_Initialize()
  41. Dim IStyle As Long
  42. Dim hwnd As Long
  43. hwnd = FindWindow("ThunderDFrame", Me.Caption)
  44. IStyle = GetWindowLong(hwnd, GWL_STYLE)
  45. IStyle = IStyle And Not WS_CAPTION
  46. SetWindowLong hwnd, GWL_STYLE, IStyle
  47. DrawMenuBar hwnd
  48. IStyle = GetWindowLong(hwnd, GWL_EXSTYLE) And Not WS_EX_DLGMODALFRAME
  49. SetWindowLong hwnd, GWL_EXSTYLE, IStyle
  50. With Me
  51. .StartUpPosition = 0
  52. .Left = Val(GetSetting("262235.xyz", "Settings", "Left", "400")) ' 设置工具栏位置
  53. .Top = Val(GetSetting("262235.xyz", "Settings", "Top", "55"))
  54. .Height = 30
  55. .Width = 336
  56. End With
  57. OutlineKey = True
  58. OptKey = True
  59. ' 读取角线设置
  60. Bleed.text = API.GetSet("Bleed")
  61. Line_len.text = API.GetSet("Line_len")
  62. Outline_Width.text = GetSetting("262235.xyz", "Settings", "Outline_Width", "0.2")
  63. UIFile = Path & "GMS\262235.xyz\ToolBar.jpg"
  64. If API.ExistsFile_UseFso(UIFile) Then
  65. UI.Picture = LoadPicture(UIFile) '换UI图
  66. Set pic1 = LoadPicture(UIFile)
  67. End If
  68. UIL = Path & "GMS\262235.xyz\ToolBar1.jpg"
  69. If API.ExistsFile_UseFso(UIL) Then
  70. Set pic2 = LoadPicture(UIL)
  71. UIL_Key = True
  72. End If
  73. End Sub
  74. Private Sub UI_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  75. UI.Visible = False
  76. If Y > 1 And Y < 16 And UIL_Key Then
  77. UI.Picture = pic2
  78. ElseIf Y > 16 And UIL_Key Then
  79. UI.Picture = pic1
  80. End If
  81. UI.Visible = True
  82. ' Debug.Print X & " , " & Y
  83. End Sub
  84. Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  85. If Button Then
  86. mx = X
  87. my = Y
  88. End If
  89. With Me
  90. .Height = 30
  91. End With
  92. End Sub
  93. Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  94. If Button Then
  95. Me.Left = Me.Left - mx + X
  96. Me.Top = Me.Top - my + Y
  97. End If
  98. End Sub
  99. Private Sub LOGO_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  100. If Abs(X - 14) < 14 And Abs(Y - 14) < 14 And Button = 2 Then
  101. Me.Width = 336
  102. OPEN_UI_BIG.Left = 322
  103. UI.Visible = True
  104. LOGO.Visible = False
  105. X_EXIT.Visible = False
  106. TOP_ALIGN_BT.Visible = False
  107. LEFT_ALIGN_BT.Visible = False
  108. Exit Sub
  109. End If
  110. If Button Then
  111. mx = X
  112. my = Y
  113. End If
  114. End Sub
  115. Private Sub LOGO_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  116. If Button Then
  117. Me.Left = Me.Left - mx + X
  118. Me.Top = Me.Top - my + Y
  119. End If
  120. End Sub
  121. Private Sub UI_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  122. Dim c As New Color
  123. ' 定义图标坐标pos
  124. Dim pos_x As Variant
  125. Dim pos_y As Variant
  126. pos_y = Array(14)
  127. pos_x = Array(14, 41, 67, 94, 121, 148, 174, 201, 228, 254, 281, 308, 334, 361, 388, 415, 441, 468, 495)
  128. '// 鼠标右键 扩展键按钮优先 收缩工具栏 标记范围框 居中页面 尺寸取整数 单色黑中线标记 扩展工具栏 排列工具 扩展工具栏收缩
  129. If Abs(X - pos_x(0)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  130. Me.Width = 30
  131. UI.Visible = False
  132. LOGO.Visible = True
  133. X_EXIT.Visible = True
  134. Exit Sub
  135. ElseIf Abs(X - pos_x(1)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  136. Tools.居中页面
  137. Exit Sub
  138. ElseIf Abs(X - pos_x(2)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  139. Tools.Mark_Range_Box
  140. Exit Sub
  141. ElseIf Abs(X - pos_x(3)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  142. Tools.尺寸取整
  143. Exit Sub
  144. ElseIf Abs(X - pos_x(5)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  145. 自动中线色阶条.Auto_ColorMark_K
  146. Exit Sub
  147. '//分分合合把几个功能按键合并到一起,定义到右键上
  148. ElseIf Abs(X - pos_x(4)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  149. Tools.分分合合
  150. Exit Sub
  151. ElseIf Abs(X - pos_x(6)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  152. 智能群组和查找.智能群组 API.Create_Tolerance
  153. Exit Sub
  154. ElseIf Abs(X - pos_x(8)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  155. '// 右键扩展工具栏
  156. Me.Height = 30 + 45
  157. Exit Sub
  158. ElseIf Abs(X - pos_x(10)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  159. '// 右键排列工具
  160. TOP_ALIGN_BT.Visible = True
  161. LEFT_ALIGN_BT.Visible = True
  162. Exit Sub
  163. ElseIf Abs(X - pos_x(11)) < 14 And Abs(Y - pos_y(0)) < 14 And Button = 2 Then
  164. '// 右键扩展工具栏收缩
  165. Me.Height = 30
  166. Exit Sub
  167. End If
  168. '// 鼠标左键 单击按钮功能 按工具栏上图标正常功能
  169. If Abs(X - pos_x(0)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  170. 裁切线.start
  171. ElseIf Abs(X - pos_x(1)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  172. 剪贴板尺寸建立矩形.start
  173. ElseIf Abs(X - pos_x(2)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  174. 裁切线.SelectLine_to_Cropline
  175. ElseIf Abs(X - pos_x(3)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  176. 拼版裁切线.arrange
  177. ElseIf Abs(X - pos_x(4)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  178. 拼版裁切线.Cut_lines
  179. ElseIf Abs(X - pos_x(5)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  180. 自动中线色阶条.Auto_ColorMark
  181. ElseIf Abs(X - pos_x(6)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  182. 智能群组和查找.智能群组
  183. ElseIf Abs(X - pos_x(7)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  184. CQL_FIND_UI.Show 0
  185. ElseIf Abs(X - pos_x(8)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  186. Replace_UI.Show 0
  187. ElseIf Abs(X - pos_x(9)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  188. Tools.TextShape_ConvertToCurves
  189. ElseIf Abs(X - pos_x(10)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  190. '// 扩展工具栏
  191. Me.Height = 30 + 45
  192. Speak_Msg "左右键有不同功能"
  193. ElseIf Abs(X - pos_x(11)) < 14 And Abs(Y - pos_y(0)) < 14 Then
  194. '// 最小化
  195. Me.Width = 30
  196. Me.Height = 30
  197. OPEN_UI_BIG.Left = 61
  198. UI.Visible = False
  199. LOGO.Visible = True
  200. X_EXIT.Visible = True
  201. ' 保存工具条位置 Left 和 Top
  202. SaveSetting "262235.xyz", "Settings", "Left", Me.Left
  203. SaveSetting "262235.xyz", "Settings", "Top", Me.Top
  204. Speak_Msg "左键缩小 右键收缩"
  205. End If
  206. End Sub
  207. Private Sub X_EXIT_Click()
  208. Unload Me ' 关闭
  209. End Sub
  210. Private Sub 调用多页合并工具()
  211. Dim value As Integer
  212. value = GMSManager.RunMacro("合并多页工具", "合并多页运行.run")
  213. End Sub
  214. Private Sub Cdr_Nodes_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  215. If Button = 2 Then
  216. TSP.Nodes_To_TSP
  217. ElseIf Shift = fmCtrlMask Then
  218. TSP.CDR_TO_TSP
  219. Else
  220. ' Ctrl + 鼠标 空
  221. End If
  222. End Sub
  223. Private Sub Cdr_Nodes_BT_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  224. TSP_L1.ForeColor = RGB(0, 150, 255)
  225. End Sub
  226. Private Sub START_TSP_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  227. TSP_L2.ForeColor = RGB(0, 150, 255)
  228. End Sub
  229. Private Sub PATH_TO_TSP_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  230. TSP_L3.ForeColor = RGB(0, 150, 255)
  231. End Sub
  232. Private Sub TSP2DRAW_LINE_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  233. TSP_L4.ForeColor = RGB(0, 150, 255)
  234. End Sub
  235. Private Sub TSP2DRAW_LINE_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  236. If Button = 2 Then
  237. TSP.TSP_TO_DRAW_LINE
  238. ElseIf Shift = fmCtrlMask Then
  239. TSP.TSP_TO_DRAW_LINES
  240. Else
  241. ' Ctrl + 鼠标 空
  242. End If
  243. End Sub
  244. Private Sub START_TSP_Click()
  245. TSP.START_TSP
  246. End Sub
  247. Private Sub PATH_TO_TSP_Click()
  248. TSP.MAKE_TSP
  249. End Sub
  250. Private Sub QR2Vector_Click()
  251. Tools.QRCode_to_Vector
  252. End Sub
  253. Private Sub BITMAP_MAKE_DOTS_Click()
  254. Tools.Python_BITMAP
  255. TSP.BITMAP_MAKE_DOTS
  256. End Sub
  257. Private Sub CBPY01_Click()
  258. Tools.Python_Organize_Size
  259. Me.Height = 30
  260. End Sub
  261. Private Sub CBPY02_Click()
  262. Tools.Python_Get_Barcode_Number
  263. Me.Height = 30
  264. End Sub
  265. Private Sub CBPY03_Click()
  266. Tools.Python_Make_QRCode
  267. Tools.QRCode_replace
  268. End Sub
  269. Private Sub OPEN_UI_BIG_Click()
  270. Unload Me
  271. CorelVBA.Show 0
  272. End Sub
  273. Private Sub Settings_Click()
  274. If 0 < Val(Bleed.text) * Val(Line_len.text) < 100 Then
  275. SaveSetting "262235.xyz", "Settings", "Bleed", Bleed.text
  276. SaveSetting "262235.xyz", "Settings", "Line_len", Line_len.text
  277. SaveSetting "262235.xyz", "Settings", "Outline_Width", Outline_Width.text
  278. End If
  279. ' 保存工具条位置 Left 和 Top
  280. SaveSetting "262235.xyz", "Settings", "Left", Me.Left
  281. SaveSetting "262235.xyz", "Settings", "Top", Me.Top
  282. Me.Height = 30
  283. End Sub
  284. '''///////// 图标鼠标左右点击功能调用 /////////'''
  285. Private Sub Tools_Icon_Click()
  286. ' 调用语句
  287. i = GMSManager.RunMacro("CorelDRAW_VBA", "学习CorelVBA.start")
  288. End Sub
  289. '''//// 选择多物件,组合然后拆分线段,为角线爬虫准备 ////'''
  290. Private Sub Split_Segment_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  291. If Button = 2 Then
  292. MsgBox "鼠标右键,功能待定"
  293. Exit Sub
  294. End If
  295. If Button Then
  296. Tools.Split_Segment
  297. End If
  298. End Sub
  299. Private Sub Split_Segment_Copy_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  300. If Button = 2 Then
  301. MsgBox "鼠标右键,功能待定"
  302. Exit Sub
  303. End If
  304. If Button Then
  305. Tools.Split_Segment
  306. End If
  307. Speak_Msg "拆分线段"
  308. End Sub
  309. '''//// CorelDRAW 与 Adobe_Illustrator 剪贴板转换 ////'''
  310. Private Sub Adobe_Illustrator_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  311. Dim value As Integer
  312. If Button = 2 Then
  313. value = GMSManager.RunMacro("AIClipboard", "CopyPaste.PasteAIFormat")
  314. Exit Sub
  315. End If
  316. If Button Then
  317. value = GMSManager.RunMacro("AIClipboard", "CopyPaste.CopyAIFormat")
  318. MsgBox "CorelDRAW 与 Adobe_Illustrator 剪贴板转换" & vbNewLine & "鼠标左键复制,鼠标右键粘贴"
  319. End If
  320. End Sub
  321. '''//// 标记画框 支持容差 ////'''
  322. Private Sub Mark_CreateRectangle_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  323. If Button = 2 Then
  324. Tools.Mark_CreateRectangle True
  325. ElseIf Shift = fmCtrlMask Then
  326. Tools.Mark_CreateRectangle False
  327. Else
  328. Create_Tolerance
  329. End If
  330. Speak_Msg "标记画框 右键支持容差"
  331. End Sub
  332. '''//// 一键拆开多行组合的文字字符 ////'''
  333. Private Sub Batch_Combine_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  334. If Button = 2 Then
  335. Tools.Batch_Combine
  336. ElseIf Shift = fmCtrlMask Then
  337. Tools.Take_Apart_Character
  338. Else
  339. Create_Tolerance
  340. End If
  341. Speak_Msg "智能拆字"
  342. End Sub
  343. '''//// 简单一刀切 ////'''
  344. Private Sub Single_Line_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  345. If Button = 2 Then
  346. Tools.Single_Line_Vertical
  347. ElseIf Shift = fmCtrlMask Then
  348. Tools.Single_Line
  349. Else
  350. Tools.Single_Line_LastNode
  351. End If
  352. Speak_Msg "简单一刀切"
  353. End Sub
  354. '''//// 傻瓜火车排列 ////'''
  355. Private Sub TOP_ALIGN_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  356. If Button = 2 Then
  357. Tools.傻瓜火车排列 3#
  358. ElseIf Shift = fmCtrlMask Then
  359. Tools.傻瓜火车排列 0#
  360. Else
  361. Tools.傻瓜火车排列 Set_Space_Width
  362. End If
  363. End Sub
  364. '''//// 傻瓜阶梯排列 ////'''
  365. Private Sub LEFT_ALIGN_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  366. If Button = 2 Then
  367. Tools.傻瓜阶梯排列 3#
  368. ElseIf Shift = fmCtrlMask Then
  369. Tools.傻瓜阶梯排列 0#
  370. Else
  371. Tools.傻瓜阶梯排列 Set_Space_Width
  372. End If
  373. End Sub
  374. '''//// 多页合并一页工具 ////'''
  375. Private Sub UniteOne_BT_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  376. If Button = 2 Then
  377. ' 右键
  378. ElseIf Shift = fmCtrlMask Then
  379. UniteOne.Show 0
  380. Speak_Msg "多页合并一页"
  381. Else
  382. ' Ctrl + 鼠标 空
  383. End If
  384. End Sub
  385. '''//// Adobe AI EPS INDD PDF和CorelDRAW 缩略图工具 ////'''
  386. Private Sub AdobeThumbnail_Click()
  387. Dim h As Long, r As Long
  388. mypath = Path & "GMS\262235.xyz\"
  389. App = mypath & "GuiAdobeThumbnail.exe"
  390. h = FindWindow(vbNullString, "CorelVBA 青年节 By 蘭雅sRGB")
  391. i = ShellExecute(h, "", App, "", mypath, 1)
  392. End Sub
  393. Private Sub Quick_Color_Select_Click()
  394. Tools.quickColorSelect
  395. End Sub