Microsoft KB Archive/84475

= FIX: Toolkit 3-D Option & Check Controls Don't Repaint in 3.1 =

Article ID: 84475

Article Last Modified on 2/23/2007

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Windows 2000 Readiness Analyzer

-



This article was previously published under Q84475



SYMPTOMS
The 3-D Option Button and 3-D Check Box custom controls in the THREED.VBX file do not paint properly if their Value property is changed while the form is loaded (hidden) before being shown. The caption area appears transparent (not painted) until the user clicks it or until the Value is changed in code after the form is shown. This problem occurs only in Windows version 3.1, not Windows version 3.0.



CAUSE
This problem occurs because of changes in the Windows GDI routines to optimize screen refresh performance. For that reason, Windows version 3.1 eliminates what it considers redundant paints.



WORKAROUND
You can work around this problem by assigning the Caption property of the affected controls to themselves when the form is shown again. This code would be placed after the Form2.Show. For example: Form.Control.Caption = Form.Control.Caption This forces a refresh of the area not being painted. Here are the steps to implement this workaround:

  Add the following code to the Command2_Click event: Sub Command2_Click Option3D3.Value=1 Check3D3.Value=1 Form2.Show Form2.Option3D1.Caption = Form2.Option3D1.Caption Form2.Option3D2.Caption = Form2.Option3D2.Caption Form2.Option3D3.Caption = Form2.Option3D3.Caption Form2.Check3D1.Caption = Form2.Check3D1.Caption Form2.Check3D2.Caption = Form2.Check3D2.Caption Form2.Check3D3.Caption = Form2.Check3D3.Caption End Sub  Run the program. Change the values by clicking some checks and options. Click Form2 to hide it. Click the Second Show and notice that the paint is now handled correctly.

You can also work around this problem by explicitly doing a SetFocus call on the control(s) in question. If you are using control array(s), it should be fairly easy. For example, if you had a five-element control array of Check3D1 check boxes, use this code:

Sub Form_Paint For a% = 0 to 4 Check3D1(a%).SetFocus Next End Sub



RESOLUTION
Sheridan Software, manufacturer of the 3-D Check Box and 3-D Option Button controls, has issued an update to THREED.VBX that corrects the painting problems experienced in Windows version 3.1. To obtain this update, call the Sheridan BBS at (516) 753-5452 (2400 baud) or (516) 753-6510 (9600 baud).



STATUS
Microsoft has confirmed this to be a bug in the products listed above when used in Microsoft Windows version 3.1. This problem was corrected in Microsoft Visual Basic version 3.0 for Windows.

<div class="moreinformation_section">

Steps to Reproduce Problem
 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. Add a second form (Form2).</li> From the File menu, choose Add File. In the Files box, select the THREED.VBX custom control file. The 3-D tools appear in the Toolbox.</li>  Add the following controls to the forms, and set their properties as indicated: <pre class="fixed_text">  Form1:

Control             Property    Setting Form                FormName    Form1 Command button      CtlName     Command1 Command button      Caption     First Show Command button      CtlName     Command2 Command button      Caption     Second Show

Form2:

Control             Property    Setting --     Form                 FormName    Form2 3-D Check box       CtlName     Check3D1 3-D Check box       CtlName     Check3D2 3-D Check box       CtlName     Check3D3 3-D Option button   CtlName     Option3D1 3-D Option button   CtlName     Option3D2 3-D Option button   CtlName     Option3D3 </li>  Add the following code to the Command1_Click event procedure for Form1: Sub Command1_Click Form2.Option3D1.Value=1 ' Set values for first show. Form2.Check3D1.Value=1 Form2.Show End Sub </li>  Add the following code to the Command2_Click event procedure for Form1: Sub Command2_Click Form2.Option3D3.Value=1 Form2.Check3D3.Value=1 Form2.Show End Sub </li>  Add the following code to the Form_Click event procedure for Form2: Sub Form_Click Form2.Hide End Sub </li> Run the program.</li></ol>

When you click the First Show button, the paint occurs properly for all controls, including the controls whose values were changed in code prior to the show. On Form2, click an option box and a check box to change Values.Click on Form2 to hide the form. Click the Second Show button. The controls whose values changed prior to the form being shown are only painted around the area with the check box or option box. The rest of the area is unpainted.

Reference(s):

Sheridan Software Systems, Inc.

65 Maxess Road

Melville, NY 11747

Phone: (516) 753-0985

Fax: (516) 293-4155

Additional query words: buglist1.00 buglist2.00 fixlist3.00 1.00 2.00 3.00 3.10

Keywords: kbbug kbfix KB84475

-

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

© Microsoft Corporation. All rights reserved.