Toolbar.bas 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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. LEFT_BT.Visible = False
  80. TOP_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. End If
  129. '// 鼠标单击按钮 按工具栏上图标正常功能
  130. If Abs(x - pos_x(0)) < 14 And Abs(y - pos_y(0)) < 14 Then
  131. 裁切线.start
  132. ElseIf Abs(x - pos_x(1)) < 14 And Abs(y - pos_y(0)) < 14 Then
  133. 剪贴板尺寸建立矩形.start
  134. ElseIf Abs(x - pos_x(2)) < 14 And Abs(y - pos_y(0)) < 14 Then
  135. 裁切线.SelectLine_to_Cropline
  136. ElseIf Abs(x - pos_x(3)) < 14 And Abs(y - pos_y(0)) < 14 Then
  137. 拼版裁切线.arrange
  138. ElseIf Abs(x - pos_x(4)) < 14 And Abs(y - pos_y(0)) < 14 Then
  139. 拼版裁切线.Cut_lines
  140. ElseIf Abs(x - pos_x(5)) < 14 And Abs(y - pos_y(0)) < 14 Then
  141. 自动中线色阶条.Auto_ColorMark
  142. ElseIf Abs(x - pos_x(6)) < 14 And Abs(y - pos_y(0)) < 14 Then
  143. 智能群组和查找.智能群组
  144. ElseIf Abs(x - pos_x(7)) < 14 And Abs(y - pos_y(0)) < 14 Then
  145. CQL_FIND_UI.Show 0
  146. ElseIf Abs(x - pos_x(8)) < 14 And Abs(y - pos_y(0)) < 14 Then
  147. Replace_UI.Show 0
  148. ElseIf Abs(x - pos_x(9)) < 14 And Abs(y - pos_y(0)) < 14 Then
  149. Tools.TextShape_ConvertToCurves
  150. ElseIf Abs(x - pos_x(10)) < 14 And Abs(y - pos_y(0)) < 14 Then
  151. LEFT_BT.Visible = True
  152. TOP_BT.Visible = True
  153. ElseIf Abs(x - pos_x(11)) < 14 And Abs(y - pos_y(0)) < 14 Then
  154. Me.Width = 30
  155. OPEN_UI_BIG.Left = 61
  156. UI.Visible = False
  157. LOGO.Visible = True
  158. X_EXIT.Visible = True
  159. End If
  160. End Sub
  161. Private Sub X_EXIT_Click()
  162. Unload Me ' 关闭
  163. End Sub
  164. Private Sub LEFT_BT_Click()
  165. Tools.傻瓜火车排列
  166. End Sub
  167. Private Sub TOP_BT_Click()
  168. Tools.傻瓜阶梯排列
  169. End Sub
  170. Private Sub 调用多页合并工具()
  171. Dim value As Integer
  172. value = GMSManager.RunMacro("合并多页工具", "合并多页运行.run")
  173. End Sub
  174. Private Sub CDR_TO_TSP_Click()
  175. TSP.CDR_TO_TSP
  176. End Sub
  177. Private Sub START_TSP_Click()
  178. TSP.START_TSP
  179. End Sub
  180. Private Sub PATH_TO_TSP_Click()
  181. TSP.MAKE_TSP
  182. End Sub
  183. Private Sub QR2Vector_Click()
  184. Tools.QRCode_to_Vector
  185. End Sub
  186. Private Sub TSP_TO_DRAW_LINE_Click()
  187. TSP.TSP_TO_DRAW_LINE
  188. End Sub
  189. Private Sub BITMAP_MAKE_DOTS_Click()
  190. TSP.BITMAP_MAKE_DOTS
  191. End Sub
  192. Private Sub CBPY01_Click()
  193. Tools.Python脚本整理尺寸
  194. Me.Height = 30
  195. End Sub
  196. Private Sub CBPY02_Click()
  197. Tools.Python提取条码数字
  198. Me.Height = 30
  199. End Sub
  200. Private Sub CBPY03_Click()
  201. Tools.Python二维码QRCode
  202. Tools.QRCode_replace
  203. End Sub
  204. Private Sub OPEN_UI_BIG_Click()
  205. Unload Me
  206. CorelVBA.Show 0
  207. End Sub
  208. Private Sub Settings_Click()
  209. If 0 < Val(Bleed.text) * Val(Line_len.text) < 100 Then
  210. SaveSetting "262235.xyz", "Settings", "Bleed", Bleed.text
  211. SaveSetting "262235.xyz", "Settings", "Line_len", Line_len.text
  212. SaveSetting "262235.xyz", "Settings", "Outline_Width", Outline_Width.text
  213. End If
  214. Me.Height = 30
  215. End Sub
  216. '''///////// 图标鼠标左右点击功能调用 /////////'''
  217. Private Sub Tools_Icon_Click()
  218. ' 调用语句
  219. i = GMSManager.RunMacro("CorelDRAW_VBA", "学习CorelVBA.start")
  220. Me.Height = 30
  221. End Sub
  222. '''//// 选择多物件,组合然后拆分线段,为角线爬虫准备 ////'''
  223. Private Sub Split_Segment_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  224. If Button = 2 Then
  225. MsgBox "鼠标右键,功能待定"
  226. Exit Sub
  227. End If
  228. If Button Then
  229. Tools.Split_Segment
  230. Me.Height = 30
  231. End If
  232. End Sub
  233. Private Sub Split_Segment_Copy_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  234. If Button = 2 Then
  235. MsgBox "鼠标右键,功能待定"
  236. Exit Sub
  237. End If
  238. If Button Then
  239. Tools.Split_Segment
  240. Me.Height = 30
  241. End If
  242. End Sub
  243. '''//// CorelDRAW 与 Adobe_Illustrator 剪贴板转换差 ////'''
  244. Private Sub Adobe_Illustrator_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  245. Dim value As Integer
  246. If Button = 2 Then
  247. value = GMSManager.RunMacro("AIClipboard", "CopyPaste.PasteAIFormat")
  248. Exit Sub
  249. End If
  250. If Button Then
  251. value = GMSManager.RunMacro("AIClipboard", "CopyPaste.CopyAIFormat")
  252. MsgBox "CorelDRAW 与 Adobe_Illustrator 剪贴板转换" & vbNewLine & "鼠标左键复制,鼠标右键粘贴"
  253. End If
  254. End Sub
  255. '''//// 标记画框 支持容差 ////'''
  256. Private Sub Mark_CreateRectangle_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  257. If Button = 2 Then
  258. Tools.Mark_CreateRectangle True
  259. ElseIf Shift = fmCtrlMask Then
  260. Tools.Mark_CreateRectangle False
  261. Else
  262. Tools.Create_Tolerance
  263. End If
  264. End Sub
  265. ''//// 一键拆开多行组合的文字字符 ////'''
  266. Private Sub Batch_Combine_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
  267. If Button = 2 Then
  268. Tools.Batch_Combine
  269. MsgBox "右键暂定功能: 智能群组后的拆开组合"
  270. ElseIf Shift = fmCtrlMask Then
  271. Tools.Take_Apart_Character
  272. Me.Height = 30
  273. Else
  274. Tools.Create_Tolerance
  275. End If
  276. End Sub