Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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 ?
Posted

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();
    }
 
Share this answer
 
Take a look at:

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

This gets you the color at the current mouse position.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900