Private Sub Command1_Click()Puis fais un copié/collé de ce qui apparais dans la textboix et montre-le moi
With Printer
.ScaleMode = 7
.Width = 10
.Height = 15
Text1.Text = "ton imprimante est " & .DeviceName & vbCrLf & "tu as défini son papersize à " & .PaperSize & vbCrLf & _
"en te précisant que 256 est la valeur de la constante vbPRPSUser " & vbCrLf & _
"elle a tenté de s'adapter ta demande (si dans ses possibilités) " & vbCrLf & vbCrLf & _
" elle est après cette tentative prête à gérer une impression sur du papier de " & _
.ScaleWidth & " de lage par " & .ScaleHeight & " de haut" & vbCrLf & _
"si la ligne précédente de dit pas 10 x 15, c'est que ton imprimante n'est pas conçue pour gérer " & _
"l'impression sur ce format ou que, si oui, son pilote n'est pas le bon"
End With
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Declare Function DeviceCapabilities Lib "winspool.drv" Alias "DeviceCapabilitiesA" (ByVal lpDeviceName As String, ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, lpDevMode As Any) As Long
Private Sub Command1_Click()
Dim a As String, r As Long, PaperSizes() As Integer, C As Long
r = DeviceCapabilities(Printer.DeviceName, "LPT1", 2, ByVal 0&, ByVal 0&)
ReDim PaperSizes(1 To r) As Integer
Call DeviceCapabilities(Printer.DeviceName, "LPT1", 2, PaperSizes(1), ByVal 0&)
a = a & "formats d'impression supportés par l'imprimante " & Printer.DeviceName
For C = 1 To r
a = a & vbCrLf & Str$(PaperSizes(C))
Next
Text1.Text = a
End Sub
large = .ScaleWidth - margeg - marged
haut = .ScaleHeight - margeh - margeb
large = 10 - margeg - marged
haut = 15 - margeh - margeb
Option Explicit
Private Sub Form_Load()
Me.Caption = App.EXEName
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
Image1.Picture = LoadPicture("D:\Mamy Photos\Lespinasse\dsc01959.jpg")
Call Imprime0
End Sub
Sub Imprime0()
Dim L As Single, H As Single, DL As Single, DH As Single, K As Double
Dim margeg As Single, marged As Single, margeh As Single, margeb As Single, large As Single, haut As Single
Printer.ScaleMode = vbCentimeters
L = ScaleX(Image1.Picture.Width, vbHimetric, Printer.ScaleMode)
H = ScaleY(Image1.Picture.Height, vbHimetric, Printer.ScaleMode)
K = H / L
'margeg = 0: marged = 0
margeg = 0.2: marged = 0.32: margeh = 0.1: margeb = 0.1
'large = Printer.ScaleWidth - margeg - marged
'haut = Printer.ScaleHeight - margeh - margeb
large = 10 - margeg -marged '<--------------------------------
haut = 15 - margeh - margeb
DL = large
DH = DL * K
If DH > haut Then
DH = haut
DL = DH / K
End If
Printer.PaintPicture Image1, margeg, margeh, DL, DH, 0, 0, L, H
Printer.EndDoc
End Sub
Select Case Printer.PaperBin
Case vbPRBNUpper
Printer.Print ("Using the upper bin")
Case vbPRBNLower
Printer.Print ("Using the lower bin")
Case vbPRBNMiddle
Printer.Print ("Using the middle bin")
Case vbPRBNManual
Printer.Print ("Insert a sheet of paper")
Case vbPRBNEnvelope
Printer.Print ("Using the envelope feeder")
Case vbPRBNEnvManual
Printer.Print ("Insert an envelope")
Case vbPRBNTractor
Printer.Print ("Using the tractor feeder")
Case vbPRBNSmallFmt
Printer.Print ("Using the small paper feeder")
Case vbPRBNLargeFmt
Printer.Print ("Using the large paper bin")
Case vbPRBNLargeCapacity
Printer.Print ("Using the large capacity feeder")
Case vbPRBNCassette
Printer.Print ("Using the attached cassette cartridge")
Case Else
Printer.Print ("Using the default paper bin")
End Select