|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
TACHE D'IMPRESSION, CRÉATION D'UN CARTOUCHE
Information sur la source
Description
Ce code utilise l'objet printer et permet de créer un cartouche avec des informations (variables globales) prisent dans un fichier.
Source
- Dim fichier As String
-
- '''''prereglage
- Printer.ScaleMode = vbMillimeters
- Printer.Orientation = 2
- Printer.PaperSize = 8 'A3
-
- fichier = "c:\app\u101\cfg\ReglageImpression.ini"
- 'on doit lire le fichier parametre impression
- If TestFichierExiste(fichier) = FIC_OK Then
- Call ReadParamImpression(fichier)
- Else
- MsgBox ("le fichier param impression n'existe pas!")
- Exit Sub
- End If
-
- fichier = "\\10.120.96.227\cfg\config.ini"
- If TestFichierExiste(fichier) = FIC_OK Then
- Call ReadFic_Param(fichier)
- Else
- MsgBox ("le fichier param n'existe pas !")
- End If
-
- G_OffsetX = 0
- G_OffsetY = 30
-
-
-
- 'on vient lire le fichier présence plateau
- fichier = "C:\Donnees\Plateau\" & G_NomBalayage & "\" & Fichier_PresencePlateau
- Call ImpressionPlateau(fichier)
-
- 'on vient lire le fichier défaut
- fichier = "C:\Donnees\Plateau\" & G_NomBalayage & "\" & Fichier_Defaut
- Call ImpressionDefaut(fichier)
-
- 'on vient lire le fichier marque!
- fichier = "C:\Donnees\Plateau\" & G_NomBalayage & "\" & Fichier_Marque
- Call ImpressionMarque(fichier)
-
-
- 'on trace le contour du balayage
- Printer.DrawStyle = vbDashDot
- Printer.DrawWidth = 4
- Printer.Line (G_OffsetX, G_OffsetY)-(G_OffsetX + G_Longueur / G_Echelle, G_OffsetY + G_Largeur / G_Echelle), , B
-
- Printer.DrawStyle = vbSolid
- Printer.DrawWidth = 1
- 'on trace le cartouche
- '1ere ligne
- Printer.Line (0, 0)-(50, 10), , B
- Printer.Line (50, 0)-(100, 10), , B
- Printer.Line (100, 0)-(150, 10), , B
- Printer.Line (150, 0)-(200, 10), , B
- Printer.Line (200, 0)-(230, 10), , B
- Printer.Line (230, 0)-(240, 10), G_TabCouleurDefaut(1), BF
- Printer.Line (240, 0)-(270, 10), , B
- Printer.Line (270, 0)-(280, 10), G_TabCouleurDefaut(4), BF
-
- '2eme ligne
- Printer.Line (0, 10)-(50, 20), , B
- Printer.Line (50, 10)-(150, 20), , B
- Printer.Line (150, 10)-(200, 20), , B
- Printer.Line (200, 10)-(230, 20), , B
- Printer.Line (230, 10)-(240, 20), G_TabCouleurDefaut(2), BF
- Printer.Line (240, 10)-(270, 20), , B
- Printer.Line (270, 10)-(280, 20), G_TabCouleurDefaut(5), BF
-
- '3eme Ligne
- Printer.Line (0, 20)-(50, 30), , B
- Printer.Line (50, 20)-(100, 30), , B
- Printer.Line (100, 20)-(150, 30), , B
- Printer.Line (150, 20)-(200, 30), , B
- Printer.Line (200, 20)-(230, 30), , B
- Printer.Line (230, 20)-(240, 30), G_TabCouleurDefaut(3), BF
- Printer.Line (240, 20)-(270, 30), , B
- Printer.Line (270, 20)-(280, 30), , B
-
- 'on renseigne le text :
- With Printer
- ''''''''''''''''''''''''''''''''''''''''''1ere colonne'''''''''''''''''''''''''''''
- 'Nom Machine
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 2
- .CurrentY = 2
- Printer.Print "U101"
-
- 'Nom Operateur
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 2
- .CurrentY = 12
- Printer.FontItalic = False
- Printer.FontUnderline = True
- Printer.FontBold = True
- Printer.Print "Opérateur : "
- .CurrentX = 27
- .CurrentY = 12
- Printer.FontItalic = True
- Printer.FontUnderline = False
- Printer.FontBold = False
- Printer.Print G_NomOperateur
- Printer.FontItalic = False
- Printer.FontUnderline = False
- Printer.FontBold = False
-
-
- 'Date
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 2
- .CurrentY = 22
- Printer.FontItalic = False
- Printer.FontUnderline = True
- Printer.FontBold = True
- Printer.Print "Date : "
- .CurrentX = 27
- .CurrentY = 22
- Printer.FontItalic = True
- Printer.FontUnderline = False
- Printer.FontBold = False
- Printer.Print G_Date
- Printer.FontItalic = False
- Printer.FontUnderline = False
- Printer.FontBold = False
- ''''''''''''''''''''''''''''''''''''''''''2eme colonne'''''''''''''''''''''''''''''
- 'Plateau
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 52
- .CurrentY = 2
- Printer.Print "Plateau"
-
- 'FCI
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 52
- .CurrentY = 12
- Printer.FontItalic = False
- Printer.FontUnderline = True
- Printer.FontBold = True
- Printer.Print "Four / Coulée / Indice :"
- .CurrentX = 102
- .CurrentY = 12
- Printer.FontItalic = True
- Printer.FontUnderline = False
- Printer.FontBold = False
- Printer.Print G_NumFour & " / " & G_NumCoulee & " / " & G_Indice
- Printer.FontItalic = False
- Printer.FontUnderline = False
- Printer.FontBold = False
-
- 'Alliage
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 52
- .CurrentY = 22
- Printer.FontItalic = False
- Printer.FontUnderline = True
- Printer.FontBold = True
- Printer.Print "Alliage : "
- .CurrentX = 77
- .CurrentY = 22
- Printer.FontItalic = True
- Printer.FontUnderline = False
- Printer.FontBold = False
- Printer.Print G_Alliage
- Printer.FontItalic = False
- Printer.FontUnderline = False
- Printer.FontBold = False
-
-
- ''''''''''''''''''''''''''''''''''''''''''3eme colonne'''''''''''''''''''''''''''''
- 'Format
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 102
- .CurrentY = 2
- Printer.FontItalic = False
- Printer.FontUnderline = True
- Printer.FontBold = True
- Printer.Print "Format : "
- .CurrentX = 127
- .CurrentY = 2
- Printer.FontItalic = True
- Printer.FontUnderline = False
- Printer.FontBold = False
- Printer.Print G_Format
- Printer.FontItalic = False
- Printer.FontUnderline = False
- Printer.FontBold = False
-
- 'Qualite
- .FontName = "Arial"
- .FontSize = 10
- .CurrentX = 102
- .CurrentY = 22
- Printer.FontItalic = False
- Printer.FontUnderline = True
- Printer.FontBold = True
- Printer.Print "Qualité : "
- .CurrentX = 127
- .CurrentY = 22
- Printer.FontItalic = True
- Printer.FontUnderline = False
- Printer.FontBold = False
- Printer.Print G_Qualite
- Printer.FontItalic = False
- Printer.FontUnderline = False
- Printer.FontBold = False
Dim fichier As String
'''''prereglage
Printer.ScaleMode = vbMillimeters
Printer.Orientation = 2
Printer.PaperSize = 8 'A3
fichier = "c:\app\u101\cfg\ReglageImpression.ini"
'on doit lire le fichier parametre impression
If TestFichierExiste(fichier) = FIC_OK Then
Call ReadParamImpression(fichier)
Else
MsgBox ("le fichier param impression n'existe pas!")
Exit Sub
End If
fichier = "\\10.120.96.227\cfg\config.ini"
If TestFichierExiste(fichier) = FIC_OK Then
Call ReadFic_Param(fichier)
Else
MsgBox ("le fichier param n'existe pas !")
End If
G_OffsetX = 0
G_OffsetY = 30
'on vient lire le fichier présence plateau
fichier = "C:\Donnees\Plateau\" & G_NomBalayage & "\" & Fichier_PresencePlateau
Call ImpressionPlateau(fichier)
'on vient lire le fichier défaut
fichier = "C:\Donnees\Plateau\" & G_NomBalayage & "\" & Fichier_Defaut
Call ImpressionDefaut(fichier)
'on vient lire le fichier marque!
fichier = "C:\Donnees\Plateau\" & G_NomBalayage & "\" & Fichier_Marque
Call ImpressionMarque(fichier)
'on trace le contour du balayage
Printer.DrawStyle = vbDashDot
Printer.DrawWidth = 4
Printer.Line (G_OffsetX, G_OffsetY)-(G_OffsetX + G_Longueur / G_Echelle, G_OffsetY + G_Largeur / G_Echelle), , B
Printer.DrawStyle = vbSolid
Printer.DrawWidth = 1
'on trace le cartouche
'1ere ligne
Printer.Line (0, 0)-(50, 10), , B
Printer.Line (50, 0)-(100, 10), , B
Printer.Line (100, 0)-(150, 10), , B
Printer.Line (150, 0)-(200, 10), , B
Printer.Line (200, 0)-(230, 10), , B
Printer.Line (230, 0)-(240, 10), G_TabCouleurDefaut(1), BF
Printer.Line (240, 0)-(270, 10), , B
Printer.Line (270, 0)-(280, 10), G_TabCouleurDefaut(4), BF
'2eme ligne
Printer.Line (0, 10)-(50, 20), , B
Printer.Line (50, 10)-(150, 20), , B
Printer.Line (150, 10)-(200, 20), , B
Printer.Line (200, 10)-(230, 20), , B
Printer.Line (230, 10)-(240, 20), G_TabCouleurDefaut(2), BF
Printer.Line (240, 10)-(270, 20), , B
Printer.Line (270, 10)-(280, 20), G_TabCouleurDefaut(5), BF
'3eme Ligne
Printer.Line (0, 20)-(50, 30), , B
Printer.Line (50, 20)-(100, 30), , B
Printer.Line (100, 20)-(150, 30), , B
Printer.Line (150, 20)-(200, 30), , B
Printer.Line (200, 20)-(230, 30), , B
Printer.Line (230, 20)-(240, 30), G_TabCouleurDefaut(3), BF
Printer.Line (240, 20)-(270, 30), , B
Printer.Line (270, 20)-(280, 30), , B
'on renseigne le text :
With Printer
''''''''''''''''''''''''''''''''''''''''''1ere colonne'''''''''''''''''''''''''''''
'Nom Machine
.FontName = "Arial"
.FontSize = 10
.CurrentX = 2
.CurrentY = 2
Printer.Print "U101"
'Nom Operateur
.FontName = "Arial"
.FontSize = 10
.CurrentX = 2
.CurrentY = 12
Printer.FontItalic = False
Printer.FontUnderline = True
Printer.FontBold = True
Printer.Print "Opérateur : "
.CurrentX = 27
.CurrentY = 12
Printer.FontItalic = True
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print G_NomOperateur
Printer.FontItalic = False
Printer.FontUnderline = False
Printer.FontBold = False
'Date
.FontName = "Arial"
.FontSize = 10
.CurrentX = 2
.CurrentY = 22
Printer.FontItalic = False
Printer.FontUnderline = True
Printer.FontBold = True
Printer.Print "Date : "
.CurrentX = 27
.CurrentY = 22
Printer.FontItalic = True
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print G_Date
Printer.FontItalic = False
Printer.FontUnderline = False
Printer.FontBold = False
''''''''''''''''''''''''''''''''''''''''''2eme colonne'''''''''''''''''''''''''''''
'Plateau
.FontName = "Arial"
.FontSize = 10
.CurrentX = 52
.CurrentY = 2
Printer.Print "Plateau"
'FCI
.FontName = "Arial"
.FontSize = 10
.CurrentX = 52
.CurrentY = 12
Printer.FontItalic = False
Printer.FontUnderline = True
Printer.FontBold = True
Printer.Print "Four / Coulée / Indice :"
.CurrentX = 102
.CurrentY = 12
Printer.FontItalic = True
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print G_NumFour & " / " & G_NumCoulee & " / " & G_Indice
Printer.FontItalic = False
Printer.FontUnderline = False
Printer.FontBold = False
'Alliage
.FontName = "Arial"
.FontSize = 10
.CurrentX = 52
.CurrentY = 22
Printer.FontItalic = False
Printer.FontUnderline = True
Printer.FontBold = True
Printer.Print "Alliage : "
.CurrentX = 77
.CurrentY = 22
Printer.FontItalic = True
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print G_Alliage
Printer.FontItalic = False
Printer.FontUnderline = False
Printer.FontBold = False
''''''''''''''''''''''''''''''''''''''''''3eme colonne'''''''''''''''''''''''''''''
'Format
.FontName = "Arial"
.FontSize = 10
.CurrentX = 102
.CurrentY = 2
Printer.FontItalic = False
Printer.FontUnderline = True
Printer.FontBold = True
Printer.Print "Format : "
.CurrentX = 127
.CurrentY = 2
Printer.FontItalic = True
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print G_Format
Printer.FontItalic = False
Printer.FontUnderline = False
Printer.FontBold = False
'Qualite
.FontName = "Arial"
.FontSize = 10
.CurrentX = 102
.CurrentY = 22
Printer.FontItalic = False
Printer.FontUnderline = True
Printer.FontBold = True
Printer.Print "Qualité : "
.CurrentX = 127
.CurrentY = 22
Printer.FontItalic = True
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print G_Qualite
Printer.FontItalic = False
Printer.FontUnderline = False
Printer.FontBold = False
Sources de la même categorie
Sources en rapport avec celle ci
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Impression de modèle [ par totof ]
Comment créer un modèle (une feuille) qui fait appelle à des données (textbox, combobox,...) et qui pourra être imprimée?
Au Secours - impression [ par bouli ]
Lorsque j'envoie le contenu d'un textbox multiligne vers un objet print et que j'imprime cet objet, la première ligne s'imprime au bon endroit (défin
Impression d'un richtextbox [ par momo ]
Je souhaite imprimer le contenu formaté d'un contrôle Richtextbox à partir d'un point quelconque de la feuille et sur la largeur voulue or la méthode
Qualité d'impression [ par Raynald ]
Bonjour, j'utilise VB6 avec une imprimante matricielle Epson LQ2550.Depuis que j'ai installé Windows 98, l'imprimante passe 2 fois sur la même ligne
Comment paramètrer l'impression d'un RichTextBox ? [ par Phèdre ]
J'arrive à imprimer, mais des lignes manques ou/et sont coupées sur la largeur des caractères.Cela ne s'améliore pas lorsque je change de police ou de
Imprime quand et fini quand??? [ par Le J ]
Salut,J'aimerais savoir quand mon impression part et quand elle fini....le tout dans le but de faire une animation pendant l'impression!!!!Si vous sav
Impression d'un Etat Access 97 depuis VB ? [ par joez ]
est ce possible ? Et si oui comment ?Merci ;))
Etat sous VB6 [ par GIGI ]
Comment définir un état en impression paysage sous VB6.J'ai essayé diverses méthodes dont celle de définir l'objet imprimante en paysage avant de lanc
Impression document Word par VB [ par merlin ]
Je cherche a imprimer un document word a partir de VB, suivant le meme principe qu'avec l'explorateur. J'y arrive avec des document Paint, Notepad, ma
Impression d'état en VB 6 [ par Aziz ]
Je suis nouveau en visual basic, je sais pas comment travailler avec le contrôle DataReport pour imprimmer des états (grouppement, expression, variabl
|
Téléchargements
Logiciels à télécharger sur le même thème :
Comparez les prix Nouvelle version
|