1/21/09
How to create TreeView using Infragistics' XamDataGrid Class
The main issue that I faced while solving this task was in method DataItems.Add(object). If you pass as parameter your object then all public fields will be displayed in grid. To make a hierarchy you need to add public property of type List<SomeClass> to your class.
8/5/08
Change background color in CEdit (MFC)
It was a real challenge for me to make a simple change of background color for CEdit. I was suprised to find out that there are no standard function, like CEdit::SetBkColor, to do this.
1. first step is to create class derived from CEdit and declare function CtlColor:
2. handle WM_CTLCOLOR_REFLECT event:
1. first step is to create class derived from CEdit and declare function CtlColor:
// CustomEdit.h
class CCustomEdit : public CEdit
{
protected:
HBRUSH CtlColor(CDC *pDC, UINT);
DECLARE_MESSAGE_MAP()
};
2. handle WM_CTLCOLOR_REFLECT event:
// CustomEdit.cpp
BEGIN_MESSAGE_MAP(CCustomEdit, CEdit)
ON_WM_CTLCOLOR_REFLECT()
END_MESSAGE_MAP()
HBRUSH CCustomEdit::CtlColor(CDC *pDC, UINT)
{
COLORREF bkColor = RGB(255, 255, 255);
pDC->SetBkColor(bkColor);
return CreateSolidBrush(bkColor);
}
Subscribe to:
Posts (Atom)
