Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem printing annotations in CWGRAPH control with VB6

I am attempting to print a cwgraph control in VB6 using the ControlImage(or ControlImageEx) property and the annotations do not print correctly.  I am creating a series of annotations on the graph to represet if 1 or 2 infrared sensors are blocked.  The annontations are simple rectanges that are either filled with dark red (1 sensor blocked) or bright red (both sensors blocked).  On the form, this works perfectly.  The control image shows the annotations as not filled in.  I have attached a picture demonstrating what I am seeing.  The top image is from a printout and the bottom is what is displayed on the screen.

 

Using ControlImage or ControlImageEx makes no difference. This is with the latest version of measurement studio 8.5 in vb6. 

Thanks in advance.

0 Kudos
Message 1 of 3
(7,187 Views)

Hey pbrand,

That is strange behavior. It looks like it is filling in only the first rectangle for each change in color. How exactly are you making use of ControlImage in your code? Is there any way you can post some of your code so I can try to reproduce your problem?

 

Here is a KnowledgeBase article on the subject as well that may be useful: http://digital.ni.com/public.nsf/allkb/DC3430165BC916C586256317006F8CC9?OpenDocument

 

Lars

 

0 Kudos
Message 2 of 3
(7,148 Views)

Hi Lars,

 

I am printing using a DataReport so what I do is this:

 

With Profile.Sections("ProfileData_Detail")

    Set .Controls("imgGraph").Picture = Me.cwProfile(GraphNumber).ControlImageEx(Printer.PrintQuality, Printer.PrintQuality)

End With

 

I have tried using ControlImage and ControlImageEx with the same results. I have also tried saving the controlimage directly to a file with the same results.

 

This is how I build the annotations for the graph:

    For g = 0 To 2
        With Me.cwProfile(g)
            For i = 0 To NumOccupancySamples
                'Only create an annotation if an infared sensor is blocked.
                If lane(LaneNum).Car.Profile(i).Sensor1Active = True Or lane(LaneNum).Car.Profile(i).Sensor2Active = True Then
                    Call BuildInfraredCoordinates(i, 1)  'Calculate the values for xCoordInfrared and yCoordInfrared.

                    .Annotations.Add
                    .Annotations(.Annotations.Count).CoordinateType = cwAxesCoordinates
                    .Annotations(.Annotations.Count).Shape.LineWidth = 0
                    .Annotations(.Annotations.Count).Shape.Type = cwShapeRectangle
                    .Annotations(.Annotations.Count).Shape.SetCoordinates xCoordInfrared, yCoordInfrared
                   
                    'Fill rectangle if sensor is active
                    If lane(LaneNum).Car.Profile(i).Sensor1Active = True And lane(LaneNum).Car.Profile(i).Sensor2Active = True Then
                        'Both sensors blocked.
                        .Annotations(.Annotations.Count).Shape.FillVisible = True
                        .Annotations(.Annotations.Count).Shape.LineColor = COLOR_BOTH
                        .Annotations(.Annotations.Count).Shape.Color = COLOR_BOTH
                    Else
                        'Only 1 sensor blocked.
                        .Annotations(.Annotations.Count).Shape.FillVisible = True
                        .Annotations(.Annotations.Count).Shape.LineColor = COLOR_SINGLE
                        .Annotations(.Annotations.Count).Shape.Color = COLOR_SINGLE
                    End If
                   
                    .Annotations(.Annotations.Count).Caption = ""
                    .Annotations(.Annotations.Count).SnapMode = cwCSnapFloating
                    .Annotations(.Annotations.Count).Plot = 1
                End If
            Next i
        End With
    Next g
 

The annotations just indicate if none, 1 or both infrared sensors where blocked.

Thanks.

0 Kudos
Message 3 of 3
(7,146 Views)