Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw

When WaveformGraph.Draw like this:

            Histogram.Draw(new ComponentDrawArgs(g, bounds));

where the bounds is determined in a print call like this:

        private void Print(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
                Rectangle r = new Rectangle(e.MarginBounds.X, e.MarginBounds.Y, e.MarginBounds.Width, e.MarginBounds.Height/2);

The x-axis is being drawn in the middle of the graph as if it is drawing in the same position as it would when drawing in the control. It implies that the Draw call is not recalculating the position of the axis based on the bounds but the plots are.

The y-axis is hidden, so I don't see what it is doing.

Any ideas?

0 Kudos
Message 1 of 8
(3,828 Views)
Please can you tell us which version of Measurement Studio you are currently using?
Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 2 of 8
(3,821 Views)
Sorry, I should have said something. 8.0.1
0 Kudos
Message 3 of 8
(3,814 Views)
I have discovered that sometimes the axis labels (1.0, 1.1, etc) on the tick marks don't appear. Or sometimes some do and some down. There seems to be a sensitivity to the dimension of the plot. By changing the size, things can come and go.

Does anyone know how to get a good clean plot when drawing on the Graphics associated with printing? Perhaps I need to make some call to the plot or graph so that it knows to do a complete redraw? My guess is the plot/graph is smart and somehow things parts of the draw area don't need updating or something like that. I could make an Invalidate call to try to fool it (I have not tried it), but that would invalidate the normal screen, etc.

Any ideas?
0 Kudos
Message 4 of 8
(3,759 Views)
Hello

The reason why some axis labels disappear is because the axis calculates the label string lenghts and figures out that the labels might start overlapping. In those cases, the axis hides those labels. To avoid this, you want to make sure that you keep the axis label string lenghts short, and keep the tick interval wide enough.

As for your first question, could you post a sample application that demonstrates the printing problem you are seeing? I would like to try and replicate the issue here.

Thanks


Bilal Durrani
NI
0 Kudos
Message 5 of 8
(3,746 Views)
Attached is an example. Compile it, run it, and press print. Choose PDF or a printer. By resising the window you can get different effects. Strange that resizing the form changes what happens when you print. You can get the axis in the wrong place, or it can even dissapear.


0 Kudos
Message 6 of 8
(3,725 Views)
I noticed that if you comment out the code in DoDrawPlotArea() method, printing works fine. I think that might have been messing up the printing.

Is there a reason why you were using the BeforeDrawPlotArea event? It didn't look like you were doing any custom drawing there.

Let me know and I can look into this some more.

Bilal Durrani
NI
0 Kudos
Message 7 of 8
(3,712 Views)
Early in the evolution of the program I did some extra drawing in that routine, but I no longer need to. I have removed the routine and things now print properly. I just never suspected that it would cause a problem.
 
Thanks.
0 Kudos
Message 8 of 8
(3,696 Views)