VB Graph Custom Control: SeeThru Does Not Paint Properly

ID Number: Q84236

1.00

WINDOWS

buglist1.00

Summary:

When you use the Graph version 1.2 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.

Microsoft has confirmed this to be a problem with the Graph version

1.2 custom control supplied with Microsoft Professional Toolkit for

Microsoft Visual Basic programming system version 1.0 for Windows. We

are researching this problem and will post new information here 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 recreate this problem are given in the example below.

Steps to Reproduce Problem

--------------------------

1. Run 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 on

Command2 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 on 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 on 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 reference words: 1.00