BUG: 3D Button Loses 256-Color Palette When Load 2nd Bitmap

Last reviewed: June 21, 1995
Article ID: Q100193
The information in this article applies to:

- Microsoft Visual Basic programming system for Windows, version 3.0

SYMPTOMS

If a second 256-color bitmap is loaded in another control after loading a 256-color bitmap in a 3D command button, the palette on the 3D command button is not restored.

CAUSE

The 3D command button control that is part of THREED.VBX does not restore its own palette. Instead, it uses the current system palette when a new 256-color bitmap is load into another control in the project. In effect this causes the 3D command button to use the palette of the new bitmap.

WORKAROUND

To work around this problem, force the current system palette to be the palette used by the 3D command button and refresh the 3D command button. For example, make the following changes to the Picture2_Click event procedure listed in step 4 of the More Information section:

   Sub Picture2_Click ()
      Picture2.Picture = LoadPicture("c:\vb3\rainbow.dib")

     ' Add the following two lines to force the picture that has
     ' the same palette as Command3d1 to the top of the ZOrder:
     Picture1.ZOrder 0
     Command3d1.Refresh

   End Sub

Using the ZOrder method with zero as an argument moves Picture1 to the top of the ZOrder. This makes the palette for Picture1 the current system palette. Because Picture1 and Command3d1 have the same bitmap loaded, you can clear up the problem by forcing the palette of Picture1 to be the system palette and refreshing the Command3d1 control.

STATUS

Microsoft has confirmed this to be a bug in 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.

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 (ALT F, A) and add THREED.VBX to your project.

  3. Add two picture boxes (Picture1 and Picture2) and one 3D command button (Command3d1) to the project.

  4. Add the following code to your program in the appropriate places:

       Sub Command3D1_Click ()
          Command3d1.Picture = LoadPicture("c:\windows\256color.bmp")
       End Sub
    
       Sub Picture1_Click ()
          Picture1.Picture = LoadPicture("c:\windows\256color.bmp")
       End Sub
    
       Sub Picture2_Click ()
          Picture2.Picture = LoadPicture("c:\vb3\rainbow.dib")
       End Sub
    
    

  5. From the Run menu, choose start (ALT, R, S), or press F5.

  6. Click Picture1.

  7. Click Command3d1. Picture1 and Command3d1 should now contain the same bitmap image.

  8. Click Picture2. Notice that the bitmap in Picture1 has maintained its palette and the bitmap in Command3d1 has lost its original colors.


Additional reference words: buglist3.00 3.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsCus APrgGrap


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: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.