BUG: VB Graph Custom Control: SeeThru Paints Incorrectly

ID: Q84236


The information in this article applies to:
  • Microsoft Visual Basic Professional Edition for Windows, versions 2.0, 3.0
  • Microsoft Professional Toolkit for Microsoft Visual Basic programming system for Windows, version 1.0


SYMPTOMS

When you use the Graph custom control with the SeeThru property set to True, Graph fails to paint properly. The Graph custom control will not repaint itself to show a see-through background nor to show updated information. Often it will create obvious holes through its parent form.

In addition, if anything on the form is under the Graph custom control, the overlapped region won't print when you execute PrintForm even though you see it on top when you print. This occurs most often when you have two overlapped Graph controls -- one with SeeThrough set to True, the other with SeeThru set to False.


STATUS

Microsoft has confirmed this to be a bug in the Graph custom control supplied with the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

The Graph SeeThru property is supposed to have a clear background when it is set to True. This property allows any text or bitmaps displayed on the parent form to show through. However, the SeeThru property does not actually behave this way.

When the SeeThru property is first set to True and the graph is repainted by setting DrawMode = 2, the background color does not become clear. Also, the graph is not repainted, but rather just painted again on top of itself. If any other properties or data were reset before the DrawMode = 2 call is made, the changes might overlap the old settings, or not appear at all.

If circumstances call for the Graph control to completely repaint itself (such as when the parent form is minimized and then maximized), Graph will not repaint at all. Because Windows is expecting Graph to paint that region, it will not repaint the parent form behind the control. Graph also does not paint that region, so a hole is left in the form that shows the desktop behind the parent form. If you try to force Graph to repaint itself by setting DrawMode = 2, the actual Graph (without the background) will appear in the hole on top of the desktop clutter.

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 graph control (Graph1), and two command buttons, Command1 and Command2.


  4. Change the following properties for the Command buttons:
    
       Control     Property    Value
       ----------------------------------------------
       Command1    Caption     SeeThru
       Command2    Caption     DrawMode 


  5. Add the following code to the Command1_Click event:
    
       Sub Command1_Click ()
          Graph1.SeeThru = 1
       End Sub 


  6. Add the following code to the Command2_Click event:
    
       Sub Command2_Click ()
          Graph1.DrawMode = 2
       End Sub 


  7. Press F5 to run the program.

    When you run the program, Graph1 appears normal. If you click the Command2 button to repaint Graph1, you will see the old graph being erased and then replaced by a new version of it. Because the random data generator inherent to Graph was left on, new data will be displayed. This is normal behavior. If you minimize and then maximize Form1, Graph1 will repaint itself correctly.


  8. Click Command1 to turn on the SeeThru property, and then click on Command2 to repaint Graph1.

    This time Graph1 does not disappear before being redrawn. Instead, the new version of the graph is just painted on top of it and the background color is still there. Again, because the random data generator was left on, new data should be displayed. If the new data values are less than the old values, they won't be seen. The bars on Graph1 will appear to continuously rise every time the Command2_Click event is triggered.


  9. Minimize Form1.

    Look at the area of the desktop where the graph control used to be. You will notice that it remains after the form is maximized.


  10. Maximize Form1.

    The desktop still appears where the Graph1 control should be. If you click the Command2 button, the graph alone will be printed in the rectangle where Graph1 should be. Again, the graph will paint on top of itself instead of repaint itself every time you trigger the Command2_Click event.


Additional query words: buglist1.00 buglist2.00 buglist3.00 1.00 2.00 3.00

Keywords :
Version : WINDOWS:2.0,3.0; :1.0
Platform : WINDOWS
Issue type :


Last Reviewed: January 25, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.