FIX: Graph Custom Control Legends May Print Incorrectly

Last reviewed: October 30, 1997
Article ID: Q82875
1.00 2.00 WINDOWS kbprg kbbuglist

The information in this article applies to:

- Professional Edition of Microsoft Visual Basic for Windows, version 2.0 - Microsoft Professional Toolkit for Microsoft Visual Basic programming

  system for Windows, version 1.0

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.


Additional reference words: buglist1.00 buglist2.00 fixlist3.00 1.00 2.00
3.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsCus APrgGrap
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.