-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathfrmPrintSign.frm
156 lines (133 loc) · 4.68 KB
/
frmPrintSign.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} frmPrintSign
Caption = "Print Sign v1.0"
ClientHeight = 4815
ClientLeft = 45
ClientTop = 390
ClientWidth = 5625
OleObjectBlob = "frmPrintSign.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "frmPrintSign"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public retval As Long
Public signX As Double, signY As Double, modShift As Long
Public sChar As String
Public customPlace As Boolean
Public offsetBottom As Integer
Private Sub btnClose_Click()
Unload Me
End Sub
Private Sub btnMake_Click()
Application.ActiveDocument.Unit = cdrMillimeter
Application.Optimization = True
If tbtnReversePage Then
signOnPagesNoRevers
Else
signOnManyPages
End If
Application.Optimization = False
ActiveWindow.Refresh
Application.Refresh
ActiveDocument.ClearSelection
End Sub
Private Sub btnPickPlace_Click()
tbPlateOffset.Enabled = False
lblPlateOffset.Enabled = False
btnPickPlace.BackColor = &H8000000D
btnPickPlace.ForeColor = &H8000000E
retval = ActiveDocument.GetUserClick(signX, signY, modShift, 100, False, cdrCursorPick)
customPlace = True
End Sub
Private Sub tbtnHoriz_Click()
If tbtnHoriz.Value Then
tbtnVertic.Value = False
Else
tbtnVertic.Value = True
End If
End Sub
Private Sub tbtnVertic_Click()
If tbtnVertic.Value Then
tbtnHoriz.Value = False
Else
tbtnHoriz.Value = True
End If
End Sub
Private Sub UserForm_Initialize()
ActiveDocument.Unit = cdrMillimeter
tbPageWidth.Value = 497
tbPageHeight.Value = 347
tbStartPage.Value = ActivePage.Index
tbLastPage.Value = ActiveDocument.Pages.Count
tbStartNumber.Value = 1
tbPlateOffset.Value = 18
tbtnReversePage.Value = True
tbSign.Text = "#0000, 4+4, 347*497, BOSSART 115, ñïóñê $"
sChar = "$"
customPlace = False
offsetBottom = 20
End Sub
Sub signOnManyPages()
Dim pWidth As Integer, pHeight As Integer
Dim placeText As String, beginS As String, lastS As String, iChar As Integer
Dim iPage As Integer, iSpusk As Integer, iEven As Integer
Dim sign As Shape
Dim aPage As Page
iSpusk = tbStartNumber.Value
iEven = 1
iChar = InStr(tbSign.Text, sChar)
beginS = Left(tbSign.Text, iChar - 1)
lastS = Mid(tbSign.Text, iChar + 1)
For iPage = tbStartPage.Value To tbLastPage.Value
Set aPage = ActiveDocument.Pages(iPage)
If (iEven Mod 2) Then
placeText = beginS & iSpusk & " ëèöî" & lastS
Else
placeText = beginS & iSpusk & " îáîðîò" & lastS
iSpusk = iSpusk + 1
End If
iEven = iEven + 1
Set sign = aPage.ActiveLayer.CreateArtisticText(0, 0, placeText, , , "Arial", 9, cdrTrue, cdrFalse, , cdrLeftAlignment)
If Not customPlace Then
signX = (aPage.BoundingBox.CenterX + (tbPageWidth.Value / 2) - (sign.BoundingBox.Height / 2))
signY = (aPage.BoundingBox.Top - tbPlateOffset.Value - tbPageHeight.Value + offsetBottom)
End If
sign.PositionX = signX
sign.PositionY = signY + sign.BoundingBox.Height
If tbtnVertic Then
sign.RotationCenterX = sign.BoundingBox.Left
sign.Rotate (90)
End If
Next iPage
End Sub
Sub signOnPagesNoRevers()
Dim pWidth As Integer, pHeight As Integer
Dim placeText As String, beginS As String, lastS As String, iChar As Integer
Dim iPage As Integer, iSpusk As Integer, iEven As Integer
Dim sign As Shape
Dim aPage As Page
iSpusk = tbStartNumber.Value
iEven = 1
iChar = InStr(tbSign.Text, sChar)
beginS = Left(tbSign.Text, iChar - 1)
lastS = Mid(tbSign.Text, iChar + 1)
For iPage = tbStartPage.Value To tbLastPage.Value
Set aPage = ActiveDocument.Pages(iPage)
placeText = beginS & iSpusk & lastS
iSpusk = iSpusk + 1
Set sign = aPage.ActiveLayer.CreateArtisticText(0, 0, placeText, , , "Arial", 9, cdrTrue, cdrFalse, , cdrLeftAlignment)
If Not customPlace Then
signX = (aPage.BoundingBox.CenterX + (tbPageWidth.Value / 2) - (sign.BoundingBox.Height / 2))
signY = (aPage.BoundingBox.Top - tbPlateOffset.Value - tbPageHeight.Value + offsetBottom)
End If
sign.PositionX = signX
sign.PositionY = signY + sign.BoundingBox.Height
If tbtnVertic Then
sign.RotationCenterX = sign.BoundingBox.Left
sign.Rotate (90)
End If
Next iPage
End Sub