07-30-2009 09:43 AM
I am wanting to put a contol on my CVI user interface that will allow the user to scroll to see the entire picture and to zoom in and out of the picture. I will be using NI-Vision to create the picture and want to programmatically display it using the control.
Anybody have any suggestions or done this before?
Neal
Solved! Go to Solution.
07-30-2009 04:13 PM
Your best bet is probably to use a canvas control. With a canvas control you can draw any subset of a bitmap and scale it to an arbitrary rectangle (see the CanvasDrawBitmap function). You can also draw a selection dragbox over the bitmap whenever the user clicks on the control (using an XOR pen mode), and then when you detect the mouse up event, you could use the dimensions of this box as the rect to pass to the drawing function.
Luis
07-30-2009 04:23 PM
Luis,
Thanks but not exactly what I am looking for. I played around with the CVI canvas control as well as the CVI picture control before I posted my question. We were originally going to put the NI-Vision viewer on the user interface but no luck with that. There is a control for labview and for Visual Basic (activeX control) but CVI will bring up a new window for the viewer.
Thanks though,
Neal
07-31-2009 07:57 AM
Hello Neal,
One possibility may be to try out what is in this thread to parent that rogue window. While it does have it's limitations (most importantly, the window can only be hosted in a CVI parent panel), it may be what you're looking for. Please let me know if that doesn't work for you, or if you have any additional questions.
NickB
National Instruments
07-31-2009 01:34 PM
Nick,
Excellent, Thanks. I proofed it out and it works great. This is (almost) exactly what I was looking for. This is almost as good as a CVI control.
Your link doesn't work though. I had to modify it to get to the thread. You might want to edit it for others if they happen on this thread.
Thanks,
Neal
07-31-2009 04:36 PM
Hey Neal,
Sorry about the link, unfortunately, if I don't catch it within five minutes of posting, I can't edit anything. I just wanted to mention that you can also use the same ActiveX control you mentioned for LabVIEW and VB6 in CVI. It's name is the CWImaqViewer control. If you aren't familiar with using ActiveX controls in CVI, check out this link... the link should be good this time 🙂
NickB
National Instruments