Microsoft KB Archive/100193
Article ID: 100193
Article Last Modified on 1/8/2003
- Microsoft Visual Basic 3.0 Professional Edition
This article was previously published under Q100193
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.
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.
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.
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
- 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.
- From the File menu, choose Add File (ALT F, A) and add THREED.VBX to your project.
- Add two picture boxes (Picture1 and Picture2) and one 3D command button (Command3d1) to the project.
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
- From the Run menu, choose start (ALT, R, S), or press F5.
- Click Picture1.
- Click Command3d1. Picture1 and Command3d1 should now contain the same bitmap image.
- Click Picture2. Notice that the bitmap in Picture1 has maintained its palette and the bitmap in Command3d1 has lost its original colors.
Additional query words: buglist3.00 3.00
Keywords: kbbug KB100193