11-02-2015 05:16 PM
Hello,
I need to import a JPG in a picture control, draw a line with 2 clicks, read bothe XY positions and perform some basic trigonometry. Any easy or striaghtforward way to draw to line with the mouse and read thos epositions on the bitmap (relative pixel positions)?
Thanks in advance,
Solved! Go to Solution.
11-02-2015 05:29 PM
Use mouse-down events and mouse move events and get the image coordinates similar to this example.
Store the start coordinates in a shift regsiter on "mouse down" and draw the line to the current position on "mouse move". Finalize the line on "mouse up". See how far you get.
11-02-2015 05:32 PM - edited 11-02-2015 05:34 PM
What have you tried? Do you want the drawing of the line to be interactive where you would see a preview of the line? Or do you want to pick two points and draw a line between, with no preview?
You'll want to use an event structure with some events for mouse down (and/or mouse move....depending on the preview requirement), some feedback nodes shift registers for storing previous clicks, and the picture functions.
11-02-2015 05:42 PM
Thank you both for the prompt responses!
Yes, I'd prefer the "interactive" line. And it has been a "while" since I last opened LV. Never worked with the mouse.
I will give my best followig days. If you have a more concrete example with the mouse events... I'd appreciate a lot!
Thanks again 🙂
11-03-2015 09:30 AM
Have you search the examples that ship with Labview?
11-03-2015 01:42 PM - edited 11-03-2015 01:42 PM
Here's a very simple example based on my suggestions. The line is temporary, and only shows while the mouse is down. At the same time, it shows the lenght of the line in an indicator.
11-03-2015 04:33 PM
11-03-2015 04:38 PM
@golubovski wrote:
Is it possible to read and prepare picture control size from the JPG in advance?
Yes.
11-04-2015 04:25 PM
This may sound ridiculus, but LabVIEW 2015 won't let me "change to write" the "bounds" proerty node(s) of the 2D picture control - this right-click option is greyed!!! I have searched and fount numerous examples where exactly this parameter (formerly DrawAreaSize) is set to be written to.
Am I missing something here?
11-04-2015 04:46 PM
OK, found it. Options are not listed in alphabetical order after all. Please disregard the previous post...