Bob,
You can read the online version of the API docs at MSDN (Microsoft Developers Network):
Here is info about custom draw and the treeview:
Announcement
Collapse
No announcement yet.
Treeview text color
Collapse
X
-
Bob,
When working with the Windows API, I find the win32 help file a bit useless, since it is not an extensive document.
I strongly recommend that anyone who wants to learn the API, purchase the latest Windows SDK CD from Microsoft. The CD is usually free, but you just pay a small charge for shipping and handling. I paid $10 for mine.
It can be found at the Microsoft MSDN web site.
Leave a comment:
-
Thanks,
I appreciate the detailed answer. I'm a little familiar with NMHDR but not NMCUSTOMDRAW.
I have win32.hlp but it doesn't seem to list some of the items and topics I've asked questions about recently. Should I just use msdn's help or is there a more up to date api docs somewhere.
Bob Mechler
Leave a comment:
-
Yes, using custom draw.
The common controls (ie. Treeview) send the NM_CUSTOMDRAW notification message through the WM_NOTIFY message.
The parent dialog processes the WM_NOTIFY message and tests for the NM_CUSTOMDRAW notification message.
In the WM_NOTIFY message the lParam value contains a pointer to the NMHDR structure.
It contains 3 members:
Code:TYPE NMHDR hwndFrom AS DWORD ' handle of control sending message idfrom AS DWORD ' ID of same control code AS LONG ' notification message or code END TYPE
The NM_CUSTOMDRAW message constant is tested in the code member of the NMHDR structure (via a pointer).
When the NM_CUSTOMDRAW notification message occurs for the treeview, the pointer in lParam points to the NMTVCUSTOMDRAW structure. Notice that structure starts with the NMCUSTOMDRAW structure and that structure starts with the NMHDR structure (which all WM_NOTIFY messages use).
Code:' TYPE NMCUSTOMDRAW hdr AS NMHDR dwDrawStage AS DWORD hdc AS DWORD rc AS RECT dwItemSpec AS DWORD ' this is control specific, but it's how to specify an item. valid only with CDDS_ITEM bit set uItemState AS DWORD lItemlParam AS LONG END TYPE ' TYPE NMTVCUSTOMDRAW nmcd AS NMCUSTOMDRAW clrText AS DWORD clrTextBk AS DWORD iLevel AS LONG END TYPE
Search the forums for NM_CUSTOMDRAW to find some code examples.
Leave a comment:
-
Treeview text color
Is it possible to set the text color of an individual treeview item after it's creation.
Why? I'd like to set black available programs and a light gray for disabled programs based on the user's clearance level. Also a third color for programs that are available but not licensed..
Bob MechlerTags: None
Leave a comment: