LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Control dll for .NET in LV

I'm trying to use NetronGraphLib or NetronLithium for :NET (http://netron.sourceforge.net/ewiki/netron.php?id=NetronGraphLib) that contains a graphic control to create complex diagrams and treeview:
I've used .NET Costructor Node method to call the class methods, but I don't see the treeview in the front panel.
 
What about it ?!
 
Regards

Elio


0 Kudos
Message 1 of 10
(4,667 Views)

Could you just post an example of what you have done here, so that we can better see where the problem might be?

Thanks

AlessioD

0 Kudos
Message 2 of 10
(4,651 Views)
I can't say whether this is going to work, since it doesn't appear that their UI controls are meant to be used seperately from their application, but if it does work...
 
You need LabVIEW 8, which is where we added the front panel control. To use it, select the .NET Container from the palette on the front panel and drop it on the diagram. Then right click and select the control you want to add. In order to work, the class you select must be a WinForm control, which these most likely are.
 
The front panel control will display a refnum on the diagram that you can then access with property and invoke nodes. There is no need to call a constructor, nor to close the refnum given out by the diagram itself (although any refnums returned from property nodes and invoke nodes do need to be closed)
0 Kudos
Message 3 of 10
(4,640 Views)
This is my example .... Thank you
0 Kudos
Message 4 of 10
(4,617 Views)
I'm afraid there isn't much I can do with this as the graphics package obviously is quite involved, just looking over the APIs in the assemblies. I'm not sure what the sequence of calls are that would generate the image you want. I would first try to find some C# or VB.NET example code that does what you want and translate the calls into LV.
 
But I can give some pointers on the VI itself in terms of LV for .NET coding.
 
1. You need to use a .NET Container in order to display the control. You don't call the constructor, as we do that automatically as part of the container. But the container is the only way to give the control somewhere to paint itself.
 
2. You were using several .NET refnum controls without initializing them to any value. This means that you were passing incorrect values to the routines. They didn't return any errors but it probably isn't what they were expected. Take a look at my example on how I pass in a PointF or Color value.
 
3. The Color values are static values in the structure (it's what the [S] means before the name). Thus you don't need to create an instance.
 
4. I'm going to guess that the shape you are trying to set the color on is the one returned by the AddShape, rather than creating your own later.
 
5. You need to ensure that you close any .NET references you create or have returned by a method/property, otherwise your VI is going to have a memory leak. The only exception is the refnum given by the .NET Container. We handle that for you.
Message 5 of 10
(4,607 Views)

I'm going to use a .NET Container, but I don't see the diagram ... What is the problem ?!

 

Regards

 

Elio Giusto
Selex Sistemi Integrati, a Finmeccanica Company

 

0 Kudos
Message 6 of 10
(4,590 Views)
I'm not sure since I'm not familiar with the API, but when I double click on the block diagram reference for the container, the front panel highlighting shows that the container is just a dot. I'm wondering whether you need to set some dimensions for the image? Do you have a simple sample program in C# or VB.NET that does what you are trying to do?
0 Kudos
Message 7 of 10
(4,581 Views)

Here is a C# example !!!

Regards

 

0 Kudos
Message 8 of 10
(4,565 Views)
Okay, I'm not going to have time to convert this to LabVIEW anything soon, so let me explain what needs to happen.
 
First, open up the file MainForm.cs in the example directory. You can just use Notepad, because VS.NET tends to hide auto-generated code - and that is just want you need to see here.
 
The way to understand this is to think of the .NET Container as the MainForm class. If you read the code, you see that the first thing done in the constructor is to call InitializeComponent.  In there, the constructor for the GraphControl is called. As I said earlier, the .NET Container in LV does that for you, so you need to start on the next line.
 
Notice how many properties are being set? That is what you need to do also. I'm not sure whether all of them are critical for your application, but at least you can see everything that is being done in the example. Note that you only need to do the ones on the graph. At the end of InitializeComponent is a few properties for the MainForm itself. You can skip that.
 
Now InitializeComponent is done and we return to the MainForm constructor. Notice that it now makes calls - first to set the background property, then to load the libraries and then all the shape stuff. This looks like what you had in your VI, so my guess is that the properties in InitializeComponent are the key items missing (such as setting the size of the control, etc).
 
Give that a try and let me know how that goes.
0 Kudos
Message 9 of 10
(4,560 Views)
I've developed an example VI that use a Lithium Library for Tree Diagram (Netron Project).
 
The problem is that the form scrolling don't run very well ...
 
Thanks
0 Kudos
Message 10 of 10
(4,516 Views)