There’s a control with a png as its background. And it may be clicked on by mouse and I wanna do sth. according to the color of the clicked point. How can I get the color? Thanks.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, from the mouse click event argument e, you can get the Point with the exact co-ordinates of the click:
Presumably, you can then grab the colour of the image at that position using something like:
Not the most efficient thing, but it gets the job done.
See:
Bitmap.GetPixelSystem.Drawing.BitmapSystem.Drawing.ImageMouseEventArgs.GetPositionSystem.Windows.Point