Jump to content

Plugin development: Getting mouse position

Recommended Posts

I'm creating a complicated plugin for Paint.Net which requires current pixel coordinate the mouse is pointing at on image as input. I have read through the Boltbait tutorial on how to create plugins, but didn't seem to be helpful. I have to admit that I'm not super experienced with writing image processing code in C# windows forms. Has anyone done anything similar or know how to do it?



Link to comment
Share on other sites

You would probably be best cloning the image to a control/container within the plugin UI. Then you could move the pointer & have that position reported back, all from within the UI.


Example: ShapeMaker

Link to comment
Share on other sites

If you display the image in your own form, then getting the pixel coordinate where the mouse is pointing is the usual mouse-event processing, followed by whatever coordinate adjustments are necessary to account for scaling and scrolling. I suspect from your question, though, that you're asking how to get the mouse position relative to the image in the main PDN form. As far as I know, there's no way to do that, though it might be nice if there were.


EDIT: Also, this question would probably be better posted to Plugin Developer's Central instead of Paint.NET Discussion & Questions.

Edited by MJW
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...