在鼠标指针下找到像素颜色? [英] find pixel color under mouse pointer?

查看:106
本文介绍了在鼠标指针下找到像素颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



首先,我是c#和编程的新手。



i am试图通过设计我感兴趣的程序来教自己编程。任何对新程序员有帮助的指针或资源都非常感激。



我的问题是如何获得鼠标指针下的像素颜色并将其用于一个if语句。



例子;



if(像素颜色为红色)

{

做点什么。

}

其他

{

做其他的事情。

}



它也必须注意这个变化。即移动到xy并观察颜色变化5秒钟。



有没有办法做到这一点?



如果我只是絮絮叨叨地告诉我你需要知道什么,我会填补空白。



i已经搜索了大约一个星期的解决方案,我似乎无法得到满足我特定需求的答案。



编辑:抱歉我坏了在解释我的需要。我需要获得像素的颜色而不点击任何东西。只需移动到xy并获取颜色,然后将颜色返回到form.cs.

解决方案

如果你不能找到任何东西,你需要认真对待你的google foo一个星期后。我搜索鼠标光标下的c#颜色,发现:



http://support.microsoft.com/kb/892462 [ ^ ]

hello,

Firstly, i am new to c# and programming in general.

i am trying to teach myself programming by designing programs that interest me. any pointers or resources that are helpful for new programmers are much appreciated.

my question is how can i get the color of a pixel under the mouse pointer and use that in an if statement.

example;

if (pixel color is red)
{
do something.
}
else
{
do something else.
}

it will have to watch for this change as well. i.e. move to the xy and watch for 5 secs for color change.

is there a way to do this?

if i have just rambled on just tell me what you need to know and i will fill in the gaps.

i have been searching for about a week for a solution to this and i cant seem to get an answer for my specific need.

edit: sorry im bad at explaining my need. i need to get the color of the pixel without clicking or anything. just move to xy and get color then return the color to form.cs.

解决方案

You need to seriously work on your google foo if you couldn;t' find anything after a week. I search "c# color under mouse cursor", and found this:

http://support.microsoft.com/kb/892462[^]


这篇关于在鼠标指针下找到像素颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆