Hallo könnte mir bitte wer weiterhelfen?
Ich erstelle zur laufzeit eine Picturebox und müsste davon das image lesen und schreiben is das irgendwie möglich?
Das erstellen geht:
Private Sub Create()
Dim pic As New PictureBox
pic.Name = "pic1"
AddHandler pic.MouseDown, AddressOf PicMouseDown
AddHandler pic.MouseUp, AddressOf PicMouseUp
AddHandler pic.MouseMove, AddressOf PicMouseMove
pic.Width = 100
pic.Height = 100
pic.SizeMode = PictureBoxSizeMode.StretchImage
pic.Image = New Bitmap(PhotoDir & File.Name)
Me.Controls.Add(pic)
End Sub
das Löschen auch:
Private Sub Create()
For Each tmp As Control In Me.Controls
If tmp.Name = "pic1"
Me.Controls.Remove(tmp)
End If
Next
aber auf das erstellte image kan man nicht zugreifen:
For Each tmp In Me.Controls
If tmp.Name = "pic1"
Exit For
End If
Next
tmp.image=nothing 'Geht nicht
Oder bin ich da total am falschen weg?
Ich erstelle zur laufzeit eine Picturebox und müsste davon das image lesen und schreiben is das irgendwie möglich?
Das erstellen geht:
Private Sub Create()
Dim pic As New PictureBox
pic.Name = "pic1"
AddHandler pic.MouseDown, AddressOf PicMouseDown
AddHandler pic.MouseUp, AddressOf PicMouseUp
AddHandler pic.MouseMove, AddressOf PicMouseMove
pic.Width = 100
pic.Height = 100
pic.SizeMode = PictureBoxSizeMode.StretchImage
pic.Image = New Bitmap(PhotoDir & File.Name)
Me.Controls.Add(pic)
End Sub
das Löschen auch:
Private Sub Create()
For Each tmp As Control In Me.Controls
If tmp.Name = "pic1"
Me.Controls.Remove(tmp)
End If
Next
aber auf das erstellte image kan man nicht zugreifen:
For Each tmp In Me.Controls
If tmp.Name = "pic1"
Exit For
End If
Next
tmp.image=nothing 'Geht nicht
Oder bin ich da total am falschen weg?
Comment