ciao,
con questo codice ;
vado a scrivere all'interno dell'immagine che poi salvo, devo dire che il codice è corretto se non fosse che non riesco a posizionare il testo nel punto che io voglio.codice:Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click ' picDemoArea.Image = Image.FromFile(TextBox2.Text) Dim xLocation, yLocation As Single ' Used for the location Dim fons As FontStyle = Label7.Text Dim graph As Graphics = Graphics.FromImage(picDemoArea.Image) Dim myFont As New Font(Label5.Text, Me.nudFontSize.Value, fons) Dim textSize As SizeF ' xLocation = TrackBar2.Value '- Label1.Width ' (picDemoArea.Width - textSize.Width) / 2 ' yLocation = Label1.Top 'TrackBar1.Value '+ Label1.Width Dim myBackBrush As Brush = Brushes.Gray Dim myForeBrush As Brush = Brushes.BurlyWood ' Dim posizione As Point = New Point(Label1.Location.Y, Label1.Location.X) graph.CompositingQuality = CompositingQuality.HighQuality textSize = graph.MeasureString(Label1.Text, myFont) graph.DrawString(Label1.Text, myFont, myForeBrush, _ New RectangleF(Label1.Location.X, Label1.Location.Y, picDemoArea.Width, picDemoArea.Height)) graph.Dispose() picDemoArea.Image.Save("C:\Documents and Settings\Pino\Documenti\" & Label3.Text, System.Drawing.Imaging.ImageFormat.Jpeg) Me.Text = xLocation & " " & yLocation End Sub
allego l'immagine per rendere più chiaro un'eventuale soluzione:
![]()
con le due trackbar muovo la label le due tackbar come valore massimo portano rispettivamente altezza e larghezza del picturebox

Rispondi quotando