2016-06-20 2 views
0

CMFCPropertyGridCtrl에서 속성의 색 (다른 모든 속성 중에서 단일 속성)을 변경하려면 어떻게해야합니까?CMFCPropertyGridCtrl에서 속성의 색을 변경하는 방법

+0

명확하게 할 수 있습니까? 배경색을 의미합니까? 너 뭐 해봤 니? –

+0

@AndrewTruckle 실제로 부동산의 텍스트 색상과 배경색을 다시 변경해야합니다. –

답변

3

CMFCPropertyGridCtrol 클래스에서 클래스를 파생시키고 CMFCPropertyGridCtrl::OnDrawProperty 메서드를 재정의해야합니다. 이렇게하면 기본 구현을 호출하기 전에 원하는대로 장치 컨텍스트를 변경할 수 있습니다.

class CMFCMyPropertyGridCtrl : public CMFCPropertyGridCtrl { 

public: 
    virtual int OnDrawProperty(CDC * pDC, CMFCPropertyGridProperty* pProp) const { 
     // Implement check to see, if this is the property we are looking for 
     // If it is, set an appropriate text color 
     pDC->SetTextColor(RGB(0xff, 0x0, 0xff)); 

     // Call the default implementation to perform rendering 
     return CMFCPropertyGridCtrl::OnDrawProperty(pDC, pProp); 
    } 
}; 
관련 문제