c# 怎么用tooltip显示pictureBox中指定颜色的坐标?
代码如下:privatevoidpBdianliu_MouseMove(objectsender,MouseEventArgse){Bitmapbmp=newBitmap...
代码如下:
private void pBdianliu_MouseMove(object sender, MouseEventArgs e)
{
Bitmap bmp = new Bitmap(this.pBdianliu.Width, this.pBdianliu.Height);
for (int w = 0; w < 240; w++)
{
for (int h = 0; h < 170; h++)
{
Color tempcolor = bmp.GetPixel(w, h);
if (tempcolor == Color.Blue)
{
double a = (170 - e.Y) / 1.5;
string aa = a.ToString("F2");
this.toolTip1.SetToolTip(this, aa);
}
}
}
我想获取pBdianliu(pictureBox控件)中颜色为Blue的坐标,求高手看看有什么问题!!! 展开
private void pBdianliu_MouseMove(object sender, MouseEventArgs e)
{
Bitmap bmp = new Bitmap(this.pBdianliu.Width, this.pBdianliu.Height);
for (int w = 0; w < 240; w++)
{
for (int h = 0; h < 170; h++)
{
Color tempcolor = bmp.GetPixel(w, h);
if (tempcolor == Color.Blue)
{
double a = (170 - e.Y) / 1.5;
string aa = a.ToString("F2");
this.toolTip1.SetToolTip(this, aa);
}
}
}
我想获取pBdianliu(pictureBox控件)中颜色为Blue的坐标,求高手看看有什么问题!!! 展开
2个回答
展开全部
private void pBdianliu_MouseMove(object sender, MouseEventArgs e)
{
Bitmap bmp = new Bitmap(this.pBdianliu.Image);
Color tempcolor = bmp.GetPixel(e.X, e.Y);
string aa = tempcolor.ToString();
this.toolTip1.SetToolTip(pBdianliu, aa);
}
更多追问追答
追问
这个怎么判断颜色呀?
追答
你运行了就看到了是分为r g b三色的数字,因为每个点都不是单纯色,所以无法得出具体颜色名称。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询