Ma se il tuo scopo principale è mentenere la scritta e cambiare l' immagine, io non userei un PictureBox, ma un Panel, che ha la proprietà .BackgroundImage[b]... come posso fare per mantenere la scritta stampata sulla picture anche se vado a modificare backgroundimage?
Un codice del genere scrive una sola volta, e la scritta non si cancella quando si cambia immagine posizionando il mouse sopra al Panel:
codice:Public Class Form1 Dim PB As New Panel Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'creo un Pannello a runtime quando lancio il Form With PB .Name = "PB" .BackgroundImage = My.Resources.image1 .Location = New System.Drawing.Point(50, 50) .Size = New Size(My.Resources.image1.Width, My.Resources.image1.Height) End With Me.Controls.Add(PB) AddHandler PB.Paint, AddressOf PB_Paint AddHandler PB.MouseHover, AddressOf PB_MouseHover End Sub Private Sub PB_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Dim Font As New System.Drawing.Font("Arial", 12) e.Graphics.DrawString("Ciao", Font, Brushes.Blue, 4, 4) End Sub Private Sub PB_MouseHover() PB.BackgroundImage = My.Resources.image2 End Sub End Class

Rispondi quotando