Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I access waveformgraph object in a c# usercontrol

Hi everyone,
 
I wonder if anyone can help me with a small problem.
 
I want to build a userControl in C# 2005 using the WaveformGraph from MCC MStudio 8.0.1.
 
My userControl has several buttons, contains several variables and a WaveformGraph.
 
I can access the variables, having made them public, with no problems.
What I can't do is access the properties of the graph.  I have tried changing the modifier, but this seems to make no difference.
 
For example, I want to change the Caption to display the title of the graph that I want to display.  Similarily, I want to set the Axis labels as well.
 
I can change the properties when the graph directly is on my form, but I don't seem to be able to find the correct incantation to do it when it is enclosed within the user control.
 
Does anyone have a simple example of how to do this?Smiley Happy
 
Many thanks
 
JW822179
Live long, prosper and understand Measurement Studio
0 Kudos
Message 1 of 3
(2,887 Views)
I was able to do this by creating a public property on the UserControl that provides a reference to the WaveformGraph. I just created a new UserControl (named UserControl1), dropped a WaveformGraph on the UserControl, and added the following code to UserControl1.cs:

public WaveformGraph TheGraph

{

get

{

return waveformGraph1;

}

}

I can then access all public properties of the WaveformGraph through the TheGraph property of UserControl1. I have attached a solution that demonstrates this. It uses Measurement Studio 8.1.1, so you might have to manually re-add the references to the Measurement Studio assemblies in the WfmGraphUserControl project.
Message 2 of 3
(2,884 Views)

Thanks for this, I would NEVER have worked this one out!

I assumed that because the waveformGraph1 was accessible to my code, then it would be accessible, if you knwow what I mean.

The really good news is that I have been able to solve other similar problems with the same type of fix.  FantasticSmiley Very Happy

John 822179

Live long, propser & understand MStudio?

 

0 Kudos
Message 3 of 3
(2,857 Views)