While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported

Original Comment

Gravatar

Richard Moss

# Reply

Glad you're finding it useful! You can use the PointToImage to convert a point such as that from MouseEventArgs into the appropriate location within the image. You can then use that result to query the bitmap either via Bitmap.GetPixel or via the direct pixels if you have already extracted and stored these via Bitmap.Lockbits. (The former is going to be slow, especially if you are going to be updating as you move the mouse around, whilst the latter is complicated to explain especially if you use pointers). Both of these assume you are using a Bitmap object even though the ImageBox uses the more generic Image instead. Although now that I think, I've never tested (or used for that matter) a metafile.

PS: I noticed in your article that you're linking to an older version of the code. Might be better to link to the GitHub page for this project instead (https://github.com/cyotek/Cyotek.Windows.Forms.ImageBox) or it's NuGet package (https://www.nuget.org/packages/CyotekImageBox/). Hmm, or maybe I should add an overview page to this site instead of scattered blog posts.

Hope that helps! Regards