LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET this.creategraphics() to get reference to Graphics object

I am using a .NET assembly (ZedGraph) to make some pretty bar graphs in LabVIEW. I haven't had any trouble translating the C# code up til now; I have no idea where to get a reference to the Graphics object that is a required input to one of the methods I want to call. Here is the relevant code that I am translating:

// Layout the GraphPanes using a default Pane Layout
using ( Graphics g = this.CreateGraphics() )
{
master.SetLayout( g, PaneLayout.SquareColPreferred );
}
So, any idea where I can get g in LabVIEW?

Thanks,
Chris
0 Kudos
Message 1 of 7
(6,496 Views)
Chris,

I'm no .NET expert but I think you'll find the CreateGraphics() method in System.Windows.Forms under Form.

If you use a .NET contructor node (to create the Windows Form) along with a .NET invoke node (to call the appropriate method) I think you should be able to get a reference to the Graphics object you need.



I hope this helps!

Regards

Simon H
Applications Engineer
National Instruments
http://www.ni.com/support/

Message Edited by Simon H on 03-05-2007 09:39 AM

Message 2 of 7
(6,470 Views)
Sweet! Nicely done. That is exactly what I was looking for. I was randomly perusing assemblies, but didn't see this anywhere (I think I even looked in System.Windows.Forms at one point, but I didn't look at the properties of the Form class). As a LabVIEW guy, this is all a little foreign to me; just out of curiousity, how did you know where to go?

I'd like to point out that in this case, the forums provided an answer to my problem before LabVIEW technical support could. Gotta love the forums!

Also, over the course of researching this problem, I discovered that Brian Tyler (aka Lycangeek) has left NI to pursue an opportunity at MS. I for one will miss his insights into the interoperability of LabVIEW with other technologies (http://detritus.blogs.com/lycangeek/).

I wish him luck in his new endeavors; if we're lucky, he'll still hang out around here every once in a while.

Chris
0 Kudos
Message 3 of 7
(6,461 Views)
Chris,

I'm also a LabVIEW guy so finding the appropriate .NET constructors is often a little difficult for me too. 

In this case searching for "CreateGraphics" on MSDN showed that I needed to be looking in the System.Windows.Forms namespace.  From there I just opened up LabVIEW and looked through the constructors until I found what I needed.

The forums have the great advantage of opening up your question to many eyes -- the combined experience of the LabVIEW community dwarfs that of any support group.  We here at NI Support also monitor the forums to make sure that every questions does get answered.

Regards,

Simon
Message 4 of 7
(6,456 Views)

Hi Crhis,

 

Could you post an example about how to use ZedGraph in LabView correctly?

 

HM

請給我一個Kudos吧, 如果有解決問題
0 Kudos
Message 5 of 7
(6,158 Views)
There's an example here.
Message 6 of 7
(6,140 Views)

Hello,

I'm trying to display OHLC values in japanese candlestick form using Zedgraph.

I've tried so hard to follow the LV-Zedgraph example in this forum but have not been successful. Has anyone tried it and been successful?

Could you send me the VI if you have it please?

Thanks,

PataPata

0 Kudos
Message 7 of 7
(4,901 Views)