鼠标光标移动以更改颜色 [英] mouse curser movement to change color

查看:106
本文介绍了鼠标光标移动以更改颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c#中是否可以将光标移动到窗口上该图片框上应用了该颜色的任何颜色?我只是想要一个基本的想法,那该怎么办?

is it possible in c# that i move cursor at which ever colour on window that colour gets applied on the picturebox? i just want a basic idea behind that ,that how should i do that ?

推荐答案

处理PictureBox的MouseMove事件,请使用GetPixel和SetPixel进行更改.
Handle the MouseMove event for the PictureBox, use GetPixel and SetPixel to change.
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
    {
    Bitmap b = (Bitmap) pictureBox1.Image;
    Color c = b.GetPixel(e.X, e.Y);
    c = Color.FromArgb(c.ToArgb() ^ 0xffffff);
    b.SetPixel( e.X, e.Y, c);
    pictureBox1.Invalidate();
    }


看看:

http://support.microsoft.com/kb/892462 [
Take a look at:

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

This gets you the color at the current mouse position.


这篇关于鼠标光标移动以更改颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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