本文介绍了如何提取RGB值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

价值不正确.

Value does not come out right.

Bitmap b = (Bitmap)pictureBox2.Image;
if (e.X >= 0 && e.X <= b.Width && e.Y >= 0 && e.Y <= b.Height)
{
   Color c = b.GetPixel(e.X, e.Y);
   mouseCOL.Text = "R : " + c.R.ToString() + " G : " + c.G.ToString()
                 + " B : " + c.B.ToString();
   pictureBox3.BackColor = Color.FromArgb(c.R, c.B, c.G);
}


实数与值不同

[更新]


Real differs from the value

[Updated]

Bitmap b = (Bitmap)pictureBox2.Image;
if (e.X >= 0 && e.X <= b.Width && e.Y >= 0 && e.Y <= b.Height)
{
Color c = b.GetPixel(e.X, e.Y);
mouseCOL.Text = "R : " + c.R.ToString() + " G : " + c.G.ToString()
+ " B : " + c.B.ToString();
pictureBox3.BackColor = Color.FromArgb(c.R, c.B, c.G);
}



出现不同的颜色
pictureBox3



Appears a different color
pictureBox3 A different color seems to

推荐答案

pictureBox3.BackColor = c;


这篇关于如何提取RGB值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 00:34