0
如何在CMFCPropertyGridCtrl
中更改屬性(所有其他屬性中的單個屬性)的顏色?如何更改CMFCPropertyGridCtrl中屬性的顏色
如何在CMFCPropertyGridCtrl
中更改屬性(所有其他屬性中的單個屬性)的顏色?如何更改CMFCPropertyGridCtrl中屬性的顏色
您需要從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);
}
};
請您澄清一下嗎?你的意思是背景顏色?你有什麼嘗試? –
@AndrewTruckle實際上我需要改變背景顏色和文字顏色 –