Ecrire texte dans l'image

scromania Messages postés 452 Date d'inscription dimanche 20 août 2006 Statut Membre Dernière intervention 11 janvier 2013 - 5 avril 2009 à 11:06
cs_ShayW Messages postés 3253 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 - 29 avril 2010 à 23:10
Bonjour à tous,

J'aimerais s'avoir comment je pourrais insérer du texte dans une image qui ce trouve déja dans une picturebox.
J'ai trouvé un bout de code ,il écrit le texte dans une nouvelle form alors j'ai enlever f.show pulus rien se passe!!!!

merci d'avance pour votre aide

Dim F As New Form
F.ShowInTaskbar = False

Dim G As Graphics = F.CreateGraphics()

Dim fontFamily As New FontFamily("Times New Roman")
Dim font As New Font(fontFamily, 24, FontStyle.Bold, GraphicsUnit.Pixel)
Dim pointF As New PointF(30, 10)
Dim solidBrush As New SolidBrush(Color.FromArgb(255, 0, 0, 255))

F.Show()
G.DrawString("Quel merdier! ;-) Hé ho, restons polis hien", font, solidBrush, pointF)

1 réponse

cs_ShayW Messages postés 3253 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 57
29 avril 2010 à 23:10
Salut
Tu as peut etre résolu si non
Private Sub Showpic(ByRef gr As System.Drawing.Graphics)
        Me.pic1.Width = Me.pic1.BackgroundImage.Width
        Me.pic1.Height = Me.pic1.BackgroundImage.Height
        Dim font1 As New Font("Arial", 16, FontStyle.Bold, GraphicsUnit.Pixel)
        Dim mybrush As New SolidBrush(Color.Coral)
        gr.DrawString("jdfjdjfd", font1, mybrush, Me.pic1.Width / 2, Me.pic1.Height / 2)
    End Sub

et ensuite il faut appeller showpic sous le event paint de pic1
Private Sub pic1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles pic1.Paint
        Showpic(e.Graphics)
    End Sub

Amuse toi bien
0
Rejoignez-nous