Changer la taille du texte quand on imprime une textbox

Fermé
argoche Messages postés 4 Date d'inscription samedi 21 décembre 2019 Statut Membre Dernière intervention 23 décembre 2019 - Modifié le 24 déc. 2019 à 01:15
Whismeril Messages postés 19147 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 3 octobre 2024 - 23 déc. 2019 à 23:17
Bonjour , je shouterai imprimer une textbox , la taille du text de la textbox est en 12 mais quand je imprime c'est tou petit comment faire ? voici mon code :

Imports System.IO

Public Class printco
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

Dim SR As New StreamReader(OpenFileDialog1.FileName)
TextBox1.Text = SR.ReadToEnd
SR.Close()
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
PrintDocument1.PrinterSettings.Copies = 1
PrintDocument1.Print()
End Sub

Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawString(TextBox1.Text, Font, Brushes.Black, 100, 100)
End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

End Sub
End Class
A voir également:

1 réponse

Whismeril Messages postés 19147 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 3 octobre 2024 919
23 déc. 2019 à 23:17
Bonjour

Pour tes prochains posts, merci d’utiliser la coloration syntaxique
https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code

Je suis littéralement à 10 000 km de mon pc, donc je ne peux pas tester, mais je dirais, que ta variable Font doit contenir la taille de la police d’impression
0