25 Oct
Posted by support as Win32/MFC 3,311 views, 0 Comments
How to hilight or bold an item in CTreeCtrl/CTreeView? There is no real difference between CTreeCtrl and CTreeView. You need to use an owner draw tree control. Takeover the NM_CUSTOMDRAW message, and it will allow you to change the font, brush, etc. of each individual item. You don’t need to do any owner draw if [...]
25 Oct
Posted by support as Win32/MFC 2,947 views, 0 Comments
Another title: How to use a derived CTreeCtrl in a CTreeView? It is similar with this article: “How to use an derived CListCtrl in CListView” or “How do I subclass the CListCtrl part of a CListView Class?“. Just like CListView, there is no CTreeCtrl to subclass in CTreeView. The CTreeView is the subclass of the [...]
Sometime you need to send/post message to CDoumnet, but CDocument is not a window, and it can’t receive message. How do that? There are 3 solutions: Solution 1: Send the message to the main window. Send/Post the message to the main frame or the view, and then call some functions of the document. But if [...]
22 Oct
Posted by support as Win32/MFC 1,987 views, 0 Comments
Read this article: How to use an derived CListCtrl in CListView
22 Oct
Posted by support as Win32/MFC 5,139 views, 0 Comments
How to sort the items of a CListCtrl or CListView(CReportView)? First, when you add items, you need to call SetItemData to attach an data structure(an integer or a pointer) to the item. Then, define a callback sort function. int CALLBACK SortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); And here, the prarameters lParam1 and lParam2 are the [...]
22 Oct
Posted by support as General 3,594 views, 2 Comments
Sometime you use CListView and need to extend the functionality of the CListCtrl of the view. For example, you want to overwrite the handler function of the NM_CUSTOMDRAW or WM_SIZE message. So the problem is: How to tell CListView to use your own CListCtrl? OK, you are on the wrong way now. The CListView does [...]
18 Oct
Posted by support as Win32/MFC 286 views, 0 Comments
A Solution which contents 3 projects and below are the names & their character set encoding type 1. Utility – > MBCS 2. Calculations -> MBCS 3. User Interface -> Unicode ( Earlier It used to be MBCS) WhenChanged the Character set encoding for User Interface and compiled the code, you will get hte Errors [...]
18 Oct
Posted by support as General 263 views, 0 Comments
How to set the head backgroud color of CPropertyPage? In the DrawItem function the TextOut position is pretty half-hearted, and looks a bit better (to my eyes) if you do it something like this instead. void CMyTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDIS) { CDC* pDC = CDC::FromHandle(lpDIS->hDC); CRect rc(lpDIS->rcItem); TCHAR szTabText[255]; TC_ITEM tci; tci.cchTextMax = sizeof(szTabText)-1; tci.pszText = szTabText; [...]
18 Oct
Posted by support as General 961 views, 0 Comments
How to set the backgroud color of CPropertyPage? If you override OnCtlColor in your property page, then you can return a different background color and that seems to work with CStatic and other items. But what if you want is a background that’s not just a simple color? You’d like to be able to draw [...]
18 Oct
Posted by support as General 4,125 views, 0 Comments
Use CListCtrl::SetItemState with LVIS_SELECTED