Ich habe dießen Code Hier
nun möchte ich eine bestimmte picturebox ansprechen deswegen wird ihr beim erstellen ein Name der in Textbox1 steht gegeben.
Aber wie mache ich das jetzt genau ?
ich möchte bloß einer bestimmten picturebox deren Name in Textbox1 eingegeben wird eine andere Backgroundcolor geben.
Bitte um Hilfe.
VB.NET-Quellcode
- Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click Dim PB As New Move_PictureBox
- With PB
- .BackColor = Color.Black
- .Size = New Point(100, 100) .Name = Textbox1.Text
- End With
- Me.Controls.Add(PB)
- End Sub
- End Class
- Public Class Move_PictureBox : Inherits PictureBox
- Dim Beweglich As Boolean = True
- Dim nStartPos As Point
- Dim nDragPos As Point
- Shadows Sub PictureBox_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
- If Beweglich Then
- If e.Button = Windows.Forms.MouseButtons.Left Then
- nStartPos = Me.Location
- nDragPos = Me.PointToScreen(New Point(e.X, e.Y))
- End If
- End If
- End Sub
- Shadows Sub PictureBox_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
- If Beweglich Then
- If e.Button = Windows.Forms.MouseButtons.Left Then
- Dim nCurPos As Point = Me.PointToScreen(New Point(e.X, e.Y))
- Me.Location = New Point(nStartPos.X + nCurPos.X - nDragPos.X, _
- nStartPos.Y + nCurPos.Y - nDragPos.Y)
- End If
- End If
- End Sub
nun möchte ich eine bestimmte picturebox ansprechen deswegen wird ihr beim erstellen ein Name der in Textbox1 steht gegeben.
Aber wie mache ich das jetzt genau ?
ich möchte bloß einer bestimmten picturebox deren Name in Textbox1 eingegeben wird eine andere Backgroundcolor geben.
Bitte um Hilfe.