Toolbar.bas 13 KB

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