FIX: Graph Custom Control Legends May Print Incorrectly (82875)



The information in this article applies to:

  • Microsoft Visual Basic Standard Edition for Windows 2.0
  • Microsoft Professional Toolkit for Microsoft Visual Basic programming system for Windows

This article was previously published under Q82875

SYMPTOMS

The Graph custom control allows you to place a legend on a graph so that each set of numerical data has a corresponding LegendText property. If one or more of the LegendText properties is a null string, Graph may space the legend texts incorrectly or make them overlap.

WORKAROUND

To work around the problem, add a string of text other than the null string to the LegendText. If you do not want any text to appear, you can add a string of spaces.

Note that this problem is related to your computer's configuration. It can appear worse on some computers, or it may not appear at all. Occasionally, the problem can be circumvented by changing the Width and/or Height property of the graph. However, you cannot calculate the amount necessary to correct the problem, and it may not prove to be a permanent solution. For these reasons we do not suggest this method as a viable workaround.

STATUS

Microsoft has confirmed this to be a bug in the Graph custom control supplied with the products listed above. This problem was corrected in the Graph custom control shipped with Microsoft Visual Basic version 3.0 for Windows.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start Visual Basic or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.
  2. From the File menu, choose Add File. In the Files box, select the GRAPH.VBX custom control file. The Graph tool appears in the toolbox.
  3. On Form1, add a command button (Command1) and a Graph control (Graph1).
  4. Change the following properties:
       Control    Property   Value
       ------------------------------------
    
       Command1   Caption    Create Legends
       Graph1     NumSets    3
       Graph1     Width      3500
       Graph1     Height     2100
    						
  5. In the Command1 Click event, add the following code:
       Sub Command1_Click ()
          Graph1.LegendText = "legend 1"
          Graph1.LegendText = ""
          Graph1.LegendText = "legend 3"
          Graph1.DrawMode = 2       'redraws graph to show new legend texts
       End Sub
    						
  6. Press F5 to run the program, and click the Command1 button.
When you run the program and click the Command1 button, the graph will update with the three LegendText properties. The second one is a null string and does not appear, but its corresponding colored box does. On most computers, this colored box appears lower than expected, and may be partially overlapped by the legend's third colored box. By changing the Width and/or Height property of Graph1, you can change the placement of the second colored box.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:kbbug kbfix KB82875