Microsoft KB Archive/191897

= BUG: Shape on Transparent UserControl May Not Redraw Properly =

Article ID: 191897

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q191897



SYMPTOMS
If you change the FillStyle property of a Shape control from Transparent to Solid at run-time, the Shape control may not redraw properly. This can happen on a transparent UserControl that is using a mask.



RESOLUTION
Set the Windowless property of the UserControl to True or call the Refresh method of the Shape control after changing the FillStyle to Solid.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



MORE INFORMATION
The Shape control does not fill in the shape when you change its FillStyle from Transparent to Solid at run-time. This happens on a UserControl that has the BackStyle set to Transparent, and you have created a masked area by setting the MaskPicture and MaskColor properties. You will only see this problem if the Windowless property of the UserControl is False.

Steps to Reproduce Behavior
 Start a new Standard EXE project in Visual Basic. Form1 is created by default. Add a UserControl to the project. Set the BackStyle of the UserControl to 0 (Transparent). Set the MaskPicture of the UserControl to an available bitmap, set the MaskColor to a color found in that picture, and set the BackColor of the UserControl to something noticeable. Place a Shape on the UserControl so that it will cover part of the masked and non-masked areas.  Insert the following code into the UserControl: Private Sub UserControl_Click Shape1.FillStyle = 0 ' Uncomment the following line to fix this bug 'Shape1.Refresh End Sub </li> Close the UserControl designer window so that the UserControl becomes available on the Toolbox.</li> Place the UserControl on Form1.</li> Run the project.</li> Click on a non-masked area of the UserControl.

RESULT: The FillStyle of the shape is now solid. However, only those parts of the control that were not masked before are colored. The expected result is that the entire Shape (rectangle) be drawn on top of the UserControl.</li></ol>

Additional query words: kbDSupport kbDSD kbVBp kbVBp600bug kbCtrlCreate

Keywords: kbbug KB191897

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.