Toolbar.bas 11 KB

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