Code:
Public Class Form1
Dim surface As Bitmap
Dim color1 As Color
Dim color2 As Color
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Integer
Dim y As Integer
Dim s As Color
s = PictureBox3.BackColor
For y = 0 To surface.Height - 1
For x = 0 To surface.Width - 1
If surface.GetPixel(x, y) = color1 Then surface.SetPixel(x, y, color2)
Next
Next
Me.BackgroundImage = surface
surface.Dispose()
End Sub
Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick
surface = New Bitmap(PictureBox1.Size.Width, PictureBox1.Size.Height)
surface = PictureBox1.Image
PictureBox2.BackColor = surface.GetPixel(e.X, e.Y)
color1 = surface.GetPixel(e.X, e.Y)
End Sub
Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
ColorDialog1.ShowDialog()
PictureBox3.BackColor = ColorDialog1.Color
color2 = Color.FromArgb(0, ColorDialog1.Color.R, ColorDialog1.Color.G, ColorDialog1.Color.B)
End Sub
End Class