CorelVBA.bas 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #If VBA7 Then
  2. 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
  3. Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  4. #Else
  5. 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
  6. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  7. #End If
  8. Option Explicit
  9. Private Sub CommandButton1_Click()
  10. TextBox1.Value = "设置出血和裁切线功能目前有个想法。谁有兴趣制作漂亮的图标请联系我."
  11. MsgBox "请每天点击右边Logo,点击博客广告一次!" & vbNewLine & "您的支持,我才能有动力添加更多功能."
  12. End Sub
  13. Private Sub UI_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  14. ' 定义图标坐标pos
  15. Dim pos_x As Variant
  16. Dim pos_Y As Variant
  17. pos_x = Array(32, 110, 186, 265, 345)
  18. pos_Y = Array(50, 135, 215)
  19. If Abs(X - pos_x(0)) < 30 And Abs(Y - pos_Y(0)) < 30 Then
  20. 物件角线
  21. ElseIf Abs(X - pos_x(1)) < 30 And Abs(Y - pos_Y(0)) < 30 Then
  22. 绘制矩形
  23. ElseIf Abs(X - pos_x(2)) < 30 And Abs(Y - pos_Y(0)) < 30 Then
  24. 角线爬虫
  25. ElseIf Abs(X - pos_x(3)) < 30 And Abs(Y - pos_Y(0)) < 30 Then
  26. 矩形拼版
  27. ElseIf Abs(X - pos_x(4)) < 30 And Abs(Y - pos_Y(0)) < 30 Then
  28. 拼版角线
  29. End If
  30. If Abs(X - pos_x(0)) < 30 And Abs(Y - pos_Y(1)) < 30 Then
  31. 居中页面
  32. ElseIf Abs(X - pos_x(1)) < 30 And Abs(Y - pos_Y(1)) < 30 Then
  33. 拼版标记
  34. ElseIf Abs(X - pos_x(2)) < 30 And Abs(Y - pos_Y(1)) < 30 Then
  35. 智能群组
  36. ElseIf Abs(X - pos_x(3)) < 30 And Abs(Y - pos_Y(1)) < 30 Then
  37. CQL选择
  38. ElseIf Abs(X - pos_x(4)) < 30 And Abs(Y - pos_Y(1)) < 30 Then
  39. 批量替换
  40. End If
  41. If Abs(X - pos_x(0)) < 30 And Abs(Y - pos_Y(2)) < 30 Then
  42. 尺寸取整
  43. ElseIf Abs(X - pos_x(1)) < 30 And Abs(Y - pos_Y(2)) < 30 Then
  44. Dim r As Long
  45. ElseIf Abs(X - pos_x(2)) < 30 And Abs(Y - pos_Y(2)) < 30 Then
  46. WebHelp "https://262235.xyz"
  47. ElseIf Abs(X - pos_x(3)) < 30 And Abs(Y - pos_Y(2)) < 30 Then
  48. WebHelp "https://262235.xyz"
  49. ElseIf Abs(X - pos_x(4)) < 30 And Abs(Y - pos_Y(2)) < 30 Then
  50. WebHelp "https://262235.xyz"
  51. End If
  52. End Sub
  53. Function WebHelp(url As String)
  54. Dim h As Long, r As Long
  55. h = FindWindow(vbNullString, "262235.xyz 老人关怀版 By 蘭雅sRGB 2022")
  56. r = ShellExecute(h, "", url, "", "", 1)
  57. End Function
  58. Private Sub 绘制矩形()
  59. 剪贴板尺寸建立矩形.start
  60. End Sub
  61. Private Sub 角线爬虫()
  62. 裁切线.SelectLine_to_Cropline
  63. End Sub
  64. Private Sub 矩形拼版()
  65. 拼版裁切线.arrange
  66. End Sub
  67. Private Sub 批量替换()
  68. CorelVBA.Hide
  69. Replace_UI.Show 0
  70. End Sub
  71. Private Sub 拼版标记()
  72. 自动中线色阶条.Auto_ColorMark
  73. End Sub
  74. Private Sub 拼版角线()
  75. 拼版裁切线.Cut_lines
  76. End Sub
  77. Private Sub 物件角线()
  78. 裁切线.start
  79. End Sub
  80. Private Sub 智能群组()
  81. 智能群组和查找.智能群组
  82. End Sub
  83. Private Sub CQL选择()
  84. CorelVBA.Hide
  85. CQL_FIND_UI.Show 0
  86. End Sub
  87. Private Sub 居中页面()
  88. ' 实践应用: 选择物件群组,页面设置物件大小,物件页面居中
  89. ActiveDocument.Unit = cdrMillimeter
  90. Dim OrigSelection As ShapeRange, sh As Shape
  91. Set OrigSelection = ActiveSelectionRange
  92. Set sh = OrigSelection.Group
  93. ActivePage.SetSize Int(sh.SizeWidth + 0.9), Int(sh.SizeHeight + 0.9)
  94. #If VBA7 Then
  95. ActiveDocument.ClearSelection
  96. sh.AddToSelection
  97. ActiveSelection.AlignAndDistribute 3, 3, 2, 0, False, 2
  98. #Else
  99. sh.AlignToPageCenter cdrAlignHCenter + cdrAlignVCenter
  100. #End If
  101. End Sub
  102. Private Sub 尺寸取整()
  103. ActiveDocument.Unit = cdrMillimeter
  104. Dim sh As Shape, shs As Shapes
  105. Set shs = ActiveSelection.Shapes
  106. Dim s As String, size As String
  107. For Each sh In shs
  108. size = Int(sh.SizeWidth + 0.5) & "x" & Int(sh.SizeHeight + 0.5) & "mm"
  109. sh.SetSize Int(sh.SizeWidth + 0.5), Int(sh.SizeHeight + 0.5)
  110. s = s & size & vbNewLine
  111. Next sh
  112. MsgBox "物件尺寸信息到剪贴板" & vbNewLine & s
  113. API.WriteClipBoard s
  114. End Sub