📄 frm票据样式.frm
字号:
Index = 3
Left = 2796
Min = -32767
TabIndex = 9
TabStop = 0 'False
Top = 1397
Width = 213
End
Begin VB.TextBox txtMargin
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 394
Index = 3
Left = 2185
TabIndex = 4
Text = "0CM"
Top = 655
Width = 622
End
Begin VB.VScrollBar scrlMargin
Height = 467
Index = 0
Left = 1225
Min = -32767
TabIndex = 3
TabStop = 0 'False
Top = 624
Width = 213
End
Begin VB.TextBox txtMargin
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 394
Index = 0
Left = 608
TabIndex = 6
Text = "0CM"
Top = 1445
Width = 622
End
Begin VB.VScrollBar scrlMargin
Height = 467
Index = 1
Left = 2846
Min = -32767
TabIndex = 5
TabStop = 0 'False
Top = 624
Width = 213
End
Begin VB.TextBox txtMargin
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 394
Index = 1
Left = 608
TabIndex = 2
Text = "0CM"
Top = 655
Width = 622
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "左"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 238
Index = 8
Left = 266
TabIndex = 21
Top = 698
Width = 237
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "右"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 238
Index = 7
Left = 1892
TabIndex = 20
Top = 698
Width = 237
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "上"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 238
Index = 6
Left = 267
TabIndex = 19
Top = 1445
Width = 238
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "下"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 238
Index = 9
Left = 1897
TabIndex = 18
Top = 1445
Width = 238
End
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "打印机"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Index = 2
Left = 120
TabIndex = 25
Top = 6480
Width = 810
End
End
Attribute VB_Name = "Frm票据样式"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Rsbj As ADODB.Recordset
Dim cx As Single, cy As Single
Private Sub cmbPaperSizes_Click()
Dim FormName As String
FormName = Mid(cmbPaperSizes.Text, 1, InStr(1, cmbPaperSizes.Text, " -") - 1)
End Sub
Private Sub Command1_Click()
Dim FormName As String
FormName = "易博科技~辅料票据" ' Use special, user-defined form.
UseForm FormName
End Sub
Private Sub Command2_Click()
Dim RetVal As Long
Dim PrinterHandle As Long ' Handle to printer
Dim PrinterName As String
Dim FormName As String
Dim Continue As Long
' Delete form that is selected in ListBox.
PrinterName = Printer.DeviceName ' Current printer
If OpenPrinter(PrinterName, PrinterHandle, 0&) Then
On Error GoTo ListBoxERR ' Trap for no selection.
FormName = Mid(cmbPaperSizes.Text, 1, InStr(1, cmbPaperSizes.Text, " -") - 1)
On Error GoTo 0 ' Turn off Error trap.
Continue = MsgBox("是否确认删除自定义纸张: " & _
FormName & " 从 " & PrinterName & "?", vbYesNo)
If Continue = vbYes Then
RetVal = DeleteForm(PrinterHandle, FormName & Chr(0))
If RetVal <> 0 Then ' DeleteForm succeeded.
cmbPaperSizes.Clear ' Reflect the deletion in the ListBox.
Form_Load ' Rebuild the list.
MsgBox "自定义纸张: " & FormName & " 删除", vbInformation, "成功!"
Else
MsgBox FormName & " 没有删除" & vbCrLf & vbCrLf & _
"错误代码: " & err.LastDllError, vbInformation, "失败!"
End If
End If
ClosePrinter (PrinterHandle)
End If
Exit Sub
ListBoxERR:
MsgBox "Select a printer from the ListBox before using this option.", _
vbExclamation
ClosePrinter (PrinterHandle)
End Sub
Private Sub Command3_Click()
Dim FormName As String
' Get FormName from the ListBox.
On Error GoTo ListBoxERR ' Trap for no selection.
FormName = Mid(cmbPaperSizes.Text, 1, InStr(1, cmbPaperSizes.Text, " -") - 1)
On Error GoTo 0 ' Turn off Error trap.
UseForm FormName
Exit Sub
ListBoxERR:
MsgBox "Select a printer from the ListBox before using this option.", _
vbExclamation
End Sub
Private Sub Command4_Click()
Rsbj.Close
Set Rsbj = New ADODB.Recordset
Rsbj.Open "Xt_PrintSize", Cw_DataEnvi.DataConnect, adOpenStatic, adLockPessimistic, adCmdTable
If Rsbj.EOF And Rsbj.BOF Then
Rsbj.AddNew
For i = 0 To 43
Rsbj.Fields(i) = Label2(i).Left / Picture1.Width * 1
Rsbj.Fields(44 + i) = Label2(i).Top / Picture1.Height * 1
Next i
Rsbj.Update
Else
For i = 0 To 43
Label2(i).Left = Rsbj.Fields(i) * Picture1.Width * 1
Label2(i).Top = Rsbj.Fields(44 + i) * Picture1.Height * 1
Next i
End If
End Sub
Private Sub Command5_Click()
PageText
End Sub
Private Sub Form_Load()
Dim NumForms As Long, i As Long
Dim FI1 As FORM_INFO_1
Dim aFI1() As FORM_INFO_1 ' Working FI1 array
Dim Temp() As Byte ' Temp FI1 array
Dim BytesNeeded As Long
Dim PrinterName As String ' Current printer
Dim PrinterHandle As Long ' Handle to printer
Dim FormItem As String ' For ListBox
Dim RetVal As Long
Dim FormSize As SIZEL ' Size of desired form
'For jsqte = 0 To -1
' DyjCombo.AddItem Printer.DeviceName
'Next jsqte
DyjCombo.AddItem Printer.DeviceName, 0
PrinterName = Printer.DeviceName ' Current printer
DyjCombo.ListIndex = 0
If OpenPrinter(PrinterName, PrinterHandle, 0&) Then
With FormSize ' Desired page size
.cx = 184000
.cy = 95000
End With
ReDim aFI1(1)
RetVal = EnumForms(PrinterHandle, 1, aFI1(0), 0&, BytesNeeded, _
NumForms)
ReDim Temp(BytesNeeded)
ReDim aFI1(BytesNeeded / Len(FI1))
RetVal = EnumForms(PrinterHandle, 1, Temp(0), BytesNeeded, _
BytesNeeded, NumForms)
Call CopyMemory(aFI1(0), Temp(0), BytesNeeded)
For i = 0 To NumForms - 1
With aFI1(i)
' List name and size including the count (index).
FormItem = PtrCtoVbString(.pName) & " - " & .Size.cx / 1000 & _
" mm X " & .Size.cy / 1000 & " mm (" & i + 1 & ")"
cmbPaperSizes.AddItem FormItem
End With
Next i
ClosePrinter (PrinterHandle)
cmbPaperSizes.ListIndex = cmbPaperSizes.ListCount - 1
End If
Set Rsbj = New ADODB.Recordset
Rsbj.Open "Xt_PrintSize", Cw_DataEnvi.DataConnect, adOpenStatic, adLockPessimistic, adCmdTable
If Rsbj.EOF And Rsbj.BOF Then
Rsbj.AddNew
For i = 0 To 43
Rsbj.Fields(i) = Label2(i).Left / Picture1.Width * 1
Rsbj.Fields(44 + i) = Label2(i).Top / Picture1.Height * 1
Next i
Rsbj.Update
Else
For i = 0 To 43
Label2(i).Left = Rsbj.Fields(i) * Picture1.Width * 1
Label2(i).Top = Rsbj.Fields(44 + i) * Picture1.Height * 1
Next i
End If
End Sub
Public Sub UseForm(FormName As String)
Dim RetVal As Integer
RetVal = SelectForm(FormName, Me.hwnd)
Select Case RetVal
Case FORM_NOT_SELECTED ' 0
' Selection failed!
MsgBox "Unable to retrieve From name", vbExclamation, _
"Operation halted!"
Case FORM_SELECTED ' 1
PrintTest
Case FORM_ADDED ' 2
' Form added and selected.
Form_Load ' by rebuilding the list.
End Select
End Sub
Private Sub Label2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
cx = X
cy = Y
End Sub
Private Sub Label2_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
'全 方 向 的 移 动
If Button = 1 Then
Label2(Index).Move Label2(Index).Left - cx + X, Label2(Index).Top - cy + Y
End If
'垂 直
If Button = 1 Then
Label2(Index).Move Label2(Index).Left, Label2(Index).Top - cy + Y
End If
'水 平
If Button = 1 Then
Label2(Index).Move Label2(Index).Left - cx + X, Label2(Index).Top
End If
End Sub
Private Sub PageText()
Dim i As Integer
'Rsbj.AddNew
For i = 0 To 43
Rsbj.Fields(i) = Label2(i).Left / Picture1.Width
Rsbj.Fields(44 + i) = Label2(i).Top / Picture1.Height
Next i
Rsbj.Update
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -