using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ModificarLosColores
{
public partial class Form1 : Form
{
Bitmap b = null;
public Form1()
{
InitializeComponent();
b = (Bitmap)pictureBox1.Image;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
try
{
Color MiColor = b.GetPixel(e.X, e.Y);
pictureBox2.BackColor = MiColor;
}
catch
{
}
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
try
{
Color MiColor = b.GetPixel(e.X, e.Y);
pictureBox3.BackColor = MiColor;
}
catch
{
}
}
private void button1_Click(object sender, EventArgs e)
{
Color buscado = pictureBox3.BackColor;
Color cambio = Color.FromArgb(255, (int)numericUpDown1.Value, (int)numericUpDown2.Value, (int)numericUpDown3.Value);
for (int i = 10; i <= b.PhysicalDimension .Width-10; i++)
{
for (int j = 10; j <= b.PhysicalDimension .Height-10; j++)
{
if (b.GetPixel(i, j).ToArgb().Equals (buscado.ToArgb ()))
{
b.SetPixel(i, j, cambio);
}
}
}
pictureBox1.Image = b;
}
}
}