frmEditPowerClip.frm 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. VERSION 5.00
  2. Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} frmEditPowerClip
  3. Caption = "容器便捷调整"
  4. ClientHeight = 3090
  5. ClientLeft = 120
  6. ClientTop = 465
  7. ClientWidth = 3510
  8. OleObjectBlob = "frmEditPowerClip.frx":0000
  9. ShowModal = 0 'False
  10. StartUpPosition = 2 'CenterScreen
  11. End
  12. Attribute VB_Name = "frmEditPowerClip"
  13. Attribute VB_GlobalNameSpace = False
  14. Attribute VB_Creatable = False
  15. Attribute VB_PredeclaredId = True
  16. Attribute VB_Exposed = False
  17. Option Explicit
  18. Dim xzbj As Boolean
  19. Private Sub Frame2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  20. Call commdanliu(Lab001)
  21. Call commdanliu(Lab002)
  22. Call commdanliu(Lab003)
  23. Call commdanliu(Lab004)
  24. Call commdanliu(Lab005)
  25. Call commdanliu(Lab006)
  26. Call commdanliu(Lab007)
  27. Call commdanliu(Lab008)
  28. End Sub
  29. Private Sub Lab001_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  30. Call anliumove(Lab001)
  31. End Sub
  32. Private Sub Lab002_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  33. Call anliumove(Lab002)
  34. End Sub
  35. Private Sub Lab003_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  36. Call anliumove(Lab003)
  37. End Sub
  38. Private Sub Lab004_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  39. Call anliumove(Lab004)
  40. End Sub
  41. Private Sub Lab005_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  42. Call anliumove(Lab005)
  43. End Sub
  44. Private Sub Lab006_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  45. Call anliumove(Lab006)
  46. End Sub
  47. Private Sub Lab007_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  48. Call anliumove(Lab007)
  49. End Sub
  50. Private Sub Lab008_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  51. Call anliumove(Lab008)
  52. End Sub
  53. Private Sub Lab001_Click()
  54. BeginOpt "提取裁切框内容"
  55. Container.Extractall (IIf(CheckBox1.Value, True, False))
  56. EndOpt
  57. End Sub
  58. Private Sub Lab002_Click()
  59. BeginOpt "清空裁切框"
  60. Container.Emptyall
  61. EndOpt
  62. End Sub
  63. Private Sub Lab003_Click()
  64. BeginOpt "按比例调整内容"
  65. Container.Bilingtznr
  66. EndOpt
  67. End Sub
  68. Private Sub Lab004_Click()
  69. BeginOpt "按比例填充"
  70. Container.Bilintianchun
  71. EndOpt
  72. End Sub
  73. Private Sub Lab005_Click()
  74. BeginOpt "延展填充"
  75. Container.Qiangzhitianmian
  76. EndOpt
  77. End Sub
  78. Private Sub Lab006_Click()
  79. BeginOpt "锁定精确裁剪"
  80. Container.Lockall True
  81. EndOpt
  82. End Sub
  83. Private Sub Lab007_Click()
  84. BeginOpt "解锁精确裁剪"
  85. Container.Lockall False
  86. EndOpt
  87. End Sub
  88. Private Sub Lab008_Click()
  89. BeginOpt "内容居中"
  90. Container.CenterToPC
  91. EndOpt
  92. End Sub
  93. Private Sub txtNilai_Change()
  94. Dim i As Integer
  95. Dim s As String
  96. With txtNilai
  97. For i = 1 To VBA.Len(.text)
  98. s = VBA.Mid(.text, i, 1)
  99. Select Case s
  100. Case ".", "0" To "9"
  101. Case Else
  102. .text = VBA.Replace(.text, s, "")
  103. End Select
  104. Next
  105. End With
  106. End Sub
  107. Private Sub SpinButton1_SpinUp()
  108. txtNilai.text = VBA.CStr(txtNilai.Value + 1)
  109. End Sub
  110. Private Sub SpinButton1_SpinDown()
  111. If txtNilai.Value <= 1 Then Exit Sub
  112. txtNilai.text = VBA.CStr(txtNilai.Value - 1)
  113. End Sub
  114. Private Sub UserForm_Initialize()
  115. If Strbjini = "" Then Strbjini = VBA.GetSetting(xylAppName, xylSection, "Apppath"): BJAppLJ = Strbjini & "\DaTa\dat\"
  116. If GetmdbValue(BJAppLJ & "xylTools.ini", "Form", "rqtzFr_l", "") <> "" Then
  117. Me.StartUpPosition = 0
  118. Me.Left = GetmdbValue(BJAppLJ & "xylTools.ini", "Form", "rqtzFr_l", "")
  119. Me.Top = GetmdbValue(BJAppLJ & "xylTools.ini", "Form", "rqtzFr_t", "")
  120. End If
  121. Call AddStroyComandBox(Me.cboUnit, "毫米,厘米,英寸,像素")
  122. Me.cboUnit.text = GetmdbValue(BJAppLJ & "xylTools.ini", "Rongqibjtz", "单位", "毫米")
  123. xzbj = False
  124. cboUnit.Enabled = False
  125. txtNilai.Enabled = False
  126. SpinButton1.Enabled = False
  127. spnPositionX.Enabled = False
  128. spnPositionY.Enabled = False
  129. spnZoom.Enabled = False
  130. spnRotate.Enabled = False
  131. Me.Tis.BackColor = RGB(0, 147, 222)
  132. Me.Tis.ForeColor = RGB(255, 255, 255)
  133. Me.Tis.Caption = " 可以选择一个容器对象后操作!"
  134. End Sub
  135. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  136. SetmdbValue BJAppLJ & "xylTools.ini", "Form", "rqtzFr_l", frmEditPowerClip.Left
  137. SetmdbValue BJAppLJ & "xylTools.ini", "Form", "rqtzFr_t", frmEditPowerClip.Top
  138. SetmdbValue BJAppLJ & "xylTools.ini", "Rongqibjtz", "单位", Me.cboUnit.text
  139. End Sub
  140. Sub getShapeByUser()
  141. re:
  142. Dim doc As Document, retval As Long
  143. Dim x As Double, Y As Double, Shift As Long
  144. Dim o_seleksi As ShapeRange
  145. Set doc = ActiveDocument
  146. doc.ReferencePoint = cdrCenter
  147. retval = doc.GetUserClick(x, Y, Shift, 10, True, cdrCursorPick)
  148. doc.ActivePage.SelectShapesAtPoint x, Y, True
  149. Dim SC As Shape
  150. Dim sp As PowerClip
  151. Set SC = ActiveShape
  152. If SC Is Nothing Then xzbj = False: Me.Show: Exit Sub
  153. Set sp = SC.PowerClip
  154. If sp Is Nothing Then
  155. AutoMsgbox "选择对象不是容器;" & vbCrLf & "可以重新选择,或点击空白处退出!", vbCritical, "新印联提示": GoTo re
  156. Else
  157. If sp.Shapes.Count = 0 Then
  158. AutoMsgbox "容器为空;" & vbCrLf & "可以重新选择,或点击空白处退出!", vbCritical, "新印联提示": GoTo re
  159. End If
  160. End If
  161. xzbj = True
  162. End Sub
  163. Sub doAction(ByVal doAction As String, Optional ByVal bolUp As Boolean = False)
  164. doAction = VBA.LCase(doAction)
  165. ActiveDocument.ReferencePoint = cdrCenter
  166. If cboUnit.ListIndex = 0 Then
  167. ActiveDocument.Unit = cdrMillimeter
  168. ElseIf cboUnit.ListIndex = 1 Then
  169. ActiveDocument.Unit = cdrCentimeter
  170. ElseIf cboUnit.ListIndex = 2 Then
  171. ActiveDocument.Unit = cdrInch
  172. ElseIf cboUnit.ListIndex = 3 Then
  173. ActiveDocument.Unit = cdrPixel
  174. End If '
  175. Dim setNilai As Double
  176. setNilai = CDbl(txtNilai.Value)
  177. If bolUp = False Then setNilai = -setNilai
  178. Dim s As Shape, sr As ShapeRange
  179. Set sr = ActiveSelectionRange
  180. For Each s In sr
  181. Call checkPowerClip(s, doAction, setNilai, bolUp)
  182. Next s
  183. End Sub
  184. Private Function checkPowerClip(s As Shape, ByVal doAction As String, ByVal setNilai As Double, ByVal bolUp As Boolean)
  185. Dim pwc As PowerClip, sr As ShapeRange
  186. If Not s.PowerClip Is Nothing Then
  187. Set pwc = s.PowerClip
  188. Set sr = pwc.Shapes.FindShapes
  189. If doAction = "position_x" Then
  190. sr.PositionX = sr.PositionX + setNilai
  191. ElseIf doAction = "position_y" Then
  192. sr.PositionY = sr.PositionY + setNilai
  193. ElseIf doAction = "rotate" Then
  194. sr.Rotate setNilai
  195. ElseIf doAction = "zoom" Then
  196. sr.Stretch sr.SizeWidth / (sr.SizeWidth + setNilai)
  197. End If
  198. End If
  199. End Function
  200. Private Sub cmdPickObject_Click()
  201. Me.Hide
  202. Call getShapeByUser
  203. If xzbj = True Then
  204. Me.Tis.Caption = " 可以重新选择一个容器操作!"
  205. If cmdPickObject.ControlTipText = "选择容器" Then
  206. cboUnit.Enabled = True
  207. txtNilai.Enabled = True
  208. SpinButton1.Enabled = True
  209. spnPositionX.Enabled = True
  210. spnPositionY.Enabled = True
  211. spnZoom.Enabled = True
  212. spnRotate.Enabled = True
  213. End If
  214. Me.Show
  215. cmdPickObject.ControlTipText = "重新选择一个容器"
  216. End If
  217. End Sub
  218. Private Sub spnPositionX_SpinDown()
  219. Call doAction("position_x", False)
  220. End Sub
  221. Private Sub spnPositionX_SpinUp()
  222. Call doAction("position_x", True)
  223. End Sub
  224. Private Sub spnPositionY_SpinDown()
  225. Call doAction("position_y", False)
  226. End Sub
  227. Private Sub spnPositionY_SpinUp()
  228. Call doAction("position_y", True)
  229. End Sub
  230. Private Sub spnRotate_SpinUp()
  231. Call doAction("rotate", False)
  232. End Sub
  233. Private Sub spnRotate_SpinDown()
  234. Call doAction("rotate", True)
  235. End Sub
  236. Private Sub spnZoom_SpinUp()
  237. Call doAction("zoom", False)
  238. End Sub
  239. Private Sub spnZoom_SpinDown()
  240. Call doAction("zoom", True)
  241. End Sub
  242. Private Sub Frame1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  243. cmdPickObject.SpecialEffect = fmSpecialEffectEtched
  244. End Sub
  245. Private Sub cmdPickObject_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  246. cmdPickObject.SpecialEffect = fmSpecialEffectSunken
  247. End Sub
  248. Private Sub cmdPickObject_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  249. cmdPickObject.SpecialEffect = fmSpecialEffectRaised
  250. End Sub
  251. Private Sub cmdPickObject_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
  252. If Button = 0 Then
  253. cmdPickObject.SpecialEffect = fmSpecialEffectRaised
  254. ElseIf Button = 1 Then
  255. cmdPickObject.SpecialEffect = fmSpecialEffectSunken
  256. End If
  257. End Sub