I have list box CListBox in which i need to specify the color of individual list item according to some condition. How can i achieve this.
Im running VS2005.
The application is a WTL Dialog based app.
How to specify individual List item's Font color in VC++ WTL
1.6k views Asked by Rohit Vipin Mathews At
2
There are 2 answers
0
Rohit Vipin Mathews
On
This is what i did to implement the same functionality in ListViewCtrl.
I wrote a class to extend the CListViewCtrl.
class CListViewCtrlEx: public CWindowImpl<CListViewCtrlEx, CListViewCtrl>, public CCustomDraw<CListViewCtrlEx>
{
public:
BEGIN_MSG_MAP(CListViewCtrlEx)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
CHAIN_MSG_MAP_ALT(CCustomDraw<CListViewCtrlEx>, 1)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bHandled);
DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw);
DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw);
void ForceMeasureItemMessage();
void DeleteItem(LPDELETEITEMSTRUCT /*lpDeleteItemStruct*/);
BOOL DeleteItem(int nItem);
void GetCellRect(int header_column, const CRect& item_rect, CRect& cell_rect);
};
The complete code is HERE.
Related Questions in VISUAL-C++
- Visual Studio C++, breakpoints not stopping debugging DLL (GODOT GDExtention)
- MSVC Compiler Template Sizeof...() not working
- Visual Studio C++ Access to path is denied
- How can I use CsvHelper to parse a string into a list of tokens?
- Unable to add request headers via CHttpFile - C++/MFC
- Is there a worked example of using CStrBufT with a CString?
- wxMediaCtrl causes access read violation when loading
- Why do I get weird class method redefinition errors when I compile with Visual C++ 2022?
- How to make VCPKG copies dependencies pdb files in output directory
- Difference between INT_MIN , INT8_MIN , INT16_MIN. For MAX too
- 'pip install mariadb' states that it cannot find include file 'mysql.h' on my Windows 10 dekstop
- Windows Custom Credential Provider is not displaying tile on logon for all users in a pc
- Why does MSVC never return struct in RAX for member-functions?
- Configure target system
- UI Interface Crashes and Hanging Issues in MFC Application
Related Questions in LISTBOX
- How to MakeScreenshot fullpage on Delphi
- How to populate a ListBox with SendMessage?
- Tkinter: How to delete items in listbox from a different window Tkinter
- How to change an item in a list forever?
- Tkinter: Listbox not populating from function call, populates from list
- TypeError: 'StringVar' object is not iterable -- tkinter ListBox()
- cdk listbox with selection "forced by code" doesn´t show as selection "by hand"
- How to save as string each item selected in listbox
- VBA listbox_click event - itemsselected not registering
- ListBox does not include newly added lines to source table because of RowSource
- Synchronization Delay Between Context Menu and Selected Row in WPF ListBox
- Is there a more efficient way to search for text from ListBox in a text in C#?
- How can I divide 2 namens and convert them to a E-Mail Adress with lixtboxes? (Visual Baisc 2010)
- How do I add all items form my database to my listbox and a counter?
- Listbox not showing data in mvvm wpf
Related Questions in VISUAL-STUDIO-2005
- How to stop elements of the Visual Studio (2019) toolbar snapping to the left
- Legacy .NET CF download - Post-deploy error 0x00000001
- Timeout when starting a Service in Windows
- Are *.pdb files bound to a specific compilation?
- My application is not working on AMD CPUs
- Vs 2005 device connection
- how to read .txt file into string windows 6 classic / windows CE, using vs2005?
- Setting proxy in c++ app on visual studio 2005
- Is there a way to load .h file for current .cpp file in Visual Studio 2019?
- "cannot open file 'user32.lib'" when trying to use Visual Studio 2005 on Windows 10
- Can TFS 2012 express be used with Visual Studio 2005?
- Running C++ CLR Visual Studio 2005 application as administrator
- Task failed because "LC.exe" was not found, or the .NET Framework SDK v2.0 is not installed
- Visual C++ 2005 Redistributable
- C++ compilation issue error - C2332: <class: missing tag name>
Related Questions in WTL
- Can't add a column to CListViewCtrl control - WTL
- atlwin and modern c++ - specifically Create taking a RECT by value
- How to get notification of child CListViewCtrl receiving focus?
- C1189 #error: /RTCc rejects conformant code
- Techniques for managing application shutdown in Win32
- Is WTL 10 compatible with Visual Studio 2022?
- property page inside property sheet paints incorrect background on windows 11
- WTL Adding a tooltip to a dynamically created button
- Change dialog font at runtime
- CreateWindow could not find window class
- CreatePropertySheetPage localization prioritizes Neutral language
- Hello, i am new in WTL, i dont understand how to reseive messages on CListViewCtrl
- Creating a scrollable dialog
- Update WTL To WTL 10: 'AtlCopyBitmap': identifier not found
- Changing the size of Datepicker cells based on WTL
Related Questions in DIALOGBASEDAPP
- Update an MFC EditControl
- How To Design a MFC Application That Will Work On All Resolutions
- Converting a Console Program into an MFC app (Thread issues) (Pleora SDK)
- MFC Dialogue based application
- MFC C++ Dialog based application UI
- Is it possible to convert a dialog based MFC application into a command line application in vc++/c++/mfc?
- Open a text file or html file with a button click in MFC
- Dialog menu not receiving Enter key
- Win32 dialog based borderless window with bitmap background and visual styles
- Adding SqlServer Database to MFC dialog based application
- How to specify individual List item's Font color in VC++ WTL
- "First-chance exception" meaning in MFC Application?
- draw simple rectangle in MFC Dialog-Based
- can we draw shapes (line,circle , etc.) in dialog-based mfc visual studio 2010?
- Why doesn't OnKeyDown catch key events in a dialog-based MFC project?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
You can create your own listbox(Ex:CColorListBox)
ColorListBox.h
ColorListBox.cpp
Here is an idea not exact code............