BUG: Stock Color Property Page Does Not Change Colors for More than Two Controls

ID: Q234524


The information in this article applies to:
  • Microsoft Visual Studio 6.0


SYMPTOMS

When using the Stock Color Property Page provided in Msstkprp.dll for more than two controls, colors will not be changed for all selected controls. It will only change a maximum of two controls at one time.


CAUSE

This is due to a bug in the internal implementation of the Stock Color Property Page.


RESOLUTION

To work around this problem, select only one or two controls at a time when you want to change the color of a property.


STATUS

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


MORE INFORMATION

Steps to Reproduce Behavior

  1. Using Visual C++ 6.0, create a new ATL project via the ATL COM AppWizard. Pick DLL as the Server Type and leave the rest of the options unchanged.


  2. Insert a new Full Control from the Insert/New ATL Object menu. Be sure to add support for the Backcolor Stock Property from the Stock Properties Page.


  3. Change the OnDraw code for the generated control to the following:


  4. 
    	HRESULT OnDraw(ATL_DRAWINFO& di)
    	{
                RECT& rc = *(RECT*)di.prcBounds;
      
                HBRUSH hbr = CreateSolidBrush(m_clrBackColor);
                FillRect(di.hdcDraw, (const RECT*) di.prcBounds, hbr);
                DeleteObject(hbr);
    
                SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
                LPCTSTR pszText = _T("ATL 3.0 : StockReproTest");
                TextOut(di.hdcDraw, 
                    (rc.left + rc.right) / 2, 
                    (rc.top + rc.bottom) / 2, 
                    pszText, 
                    lstrlen(pszText));
    
                return S_OK;
             } 
  5. Build the ATL project.


  6. Insert four copies of the control into the ActiveX Control Test Container.


  7. Select all four controls. A rectangle should appear around each one.


  8. Select the Edit/Properties menu item.


  9. Change the BackColor property to a different color. Be sure to select a color from the Standard Colors set.


  10. Click Apply.


You should notice that only two of the four controls changed color though you would have expected all of them to change.

Additional query words: ATL Stock Property Page Color VB design time

Keywords : kbCOMt kbCtrlCreate kbVS600bug kbGrpMFCATL
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: September 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.