panel1 back color is red and panel2 back color is white is selected
if i used in click event on picturebox should be shown two colors of mixing like jpg

help us.
Luv

Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Selva GanapathyRank #560 · 4.3K reputationPosted Sep 29, 2014, 5:55 AM EDT
Hi Luv L,
This code will help you in better way
var frontColor = panel1.BackColor;
var backColor = panel2.BackColor;
var fValue = frontColor.B > frontColor.G ? "B" : "G";
fValue = frontColor.B > frontColor.R ? fValue : "R";
var bValue = backColor.B > backColor.G ? "B" : "G";
bValue = backColor.B > backColor.R ? bValue : "R";
Bitmap bitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
int k = 0;
for (int i = 0; i < bitmap.Height - 5; i++)
{
for (int j = 0; j < bitmap.Width - 5; j++)
{
k++;
if (k > 255)
k = 0;
Color color;
if (fValue == "B")
{
color = Color.FromArgb(0, 0, k);
}
else if (fValue == "R")
{
color = Color.FromArgb(k, 0, 0);
}
else
{
color = Color.FromArgb(0, k, 0);
}
bitmap.SetPixel(j, i, color);
k++;
if (k > 255)
k = 0;
j++;
if (bValue == "B")
{
color = Color.FromArgb(0, 0, k);
}
else if (bValue == "R")
{
color = Color.FromArgb(k, 0, 0);
}
else
{
color = Color.FromArgb(0, k, 0);
}
bitmap.SetPixel(j, i, color);
}
}
this.pictureBox1.Image = bitmap;
Regards,
Selva Ganapathy K