Free Source Code and Program Tips
Archive for October, 2007
How to hilight an item in CTreeCtrl/CTreeView
Oct 25th
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
How to subclass CTreeCtrl in CTreeView?
Oct 25th
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
How do I subclass the CListCtrl part of a CListView Class?
Oct 22nd
Read this article: How to use an derived CListCtrl in CListView
How to sort items of CListCtrl or CListView?
Oct 22nd
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
How to use an derived CListCtrl in CListView
Oct 22nd
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
Link error when mix MBCS and Unicode in ONE project
Oct 18th
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
Set the head backgroud color of CPropertyPage
Oct 18th
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;
How to set the backgroud color of CPropertyPage
Oct 18th
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
How to select the item of ListView(CListCtrl)
Oct 18th
Use CListCtrl::SetItemState with LVIS_SELECTED