Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Generic error in GDI+ on Draw method

Hello,

 

I have a form with 5 waveformgraphs. The user has the possibility to print out this form.

This is accomplished by using the Draw method, much like described in the Examples\UI\WindowsForms\Graph\Printing with the following command: WaveformGraph.Draw(New ComponentDrawArgs(g, bounds))


Everything works fine until the graph to be displayed shows an annotation with vertical gradient color:

                    DirectCast(Me.vGraphX.Annotations.Item(1), XYRangeAnnotation).RangeFillStyle = FillStyle.CreateVerticalGradient(Color.FromArgb(90, Color.FromKnownColor(KnownColor.MidnightBlue)), DirectCast(Me.vGraphX.Annotations.Item(1), XYRangeAnnotation).RangeFillColor)

 

On the Draw method I get a "A generic error occurred in GDI+"

 

Any suggestions of how I could solve this problem?

Many thanks for your help in advance.

 

Regards,

Daniel

0 Kudos
Message 1 of 4
(3,722 Views)

Hi Daniel,

 

could you post a stripped down example so I can reproduce the error here?

 

Best Regards,

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 2 of 4
(3,693 Views)

Hi Andreas,

 

it is sort of tricky, because this behaviour does not happen at all times.

I prepared the Graph printing example with the vertical gradient option.

If I try to sent the graph with the "Print" button directly to the printer, I get the error if I use for example "FinePrint".

If I change "RangeFillStyle" to FillStyle.None or FillStyle.Solid the error disappears.

 

Any suggestions?

Many thanks in advance.

 

Best regards

Daniel

0 Kudos
Message 3 of 4
(3,689 Views)

Hi Daniel,

 

I could reproduce your problem with a specific printer in our office. It depends on the printer used. FinePrint is just a intermediate layer, so it's not really reproducable with fineprint. Is there also a PDF printer where I can reproduce the issue? This would be really helpful since I can then forward this problem to R&D to reproduce it and create a solution.

 

Best Regards,

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 4 of 4
(3,613 Views)