NM_CUSTOMDRAW and LVS_OWNERDATA

Hi all, I have a question:

I am using a virtual list control (LVS_OWNERDATA), and trying to handle the NM_CUSTOMDRAW message to draw something custom in one of the columns -- problem is, the NM_CUSTOMDRAW message only gets fired once for each item, rather than once for each column.  Anyone know how to work around this? Thanks :)

Casey
0
avatar5d (3)
10/29/2003 3:15:42 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1087 Views

Similar Articles

[PageSpeed] 23

This is normal behavior, you will need to draw the entire row when
processing the NM_CUSTOMDRAW message.

-- 
============
Frank Hickman
NobleSoft, Inc.
============

"Casey Langen" <avatar5d@hotmail.com> wrote in message
news:yQQnb.17925$vi6.10586@newssvr29.news.prodigy.com...
> Hi all, I have a question:
>
> I am using a virtual list control (LVS_OWNERDATA), and trying to handle
the NM_CUSTOMDRAW message to draw something custom in one of the columns -- 
problem is, the NM_CUSTOMDRAW message only gets fired once for each item,
rather than once for each column.  Anyone know how to work around this?
Thanks :)
>
> Casey


0
Frank
10/29/2003 6:05:58 PM
Casey Langen wrote:

>Hi all, I have a question:
>
>I am using a virtual list control (LVS_OWNERDATA), and trying to handle the NM_CUSTOMDRAW message to draw something custom in one of the columns -- problem is, the NM_CUSTOMDRAW message only gets fired once for each item, rather than once for each column.  Anyone know how to work around this? Thanks :)

To get per-item notifications, you need to return the right values depending
on the value of the NMLVCUSTOMDRAW dwDrawStage member. Also, if you handle
LVN_GETDISPINFO, you don't have to draw the whole row yourself. This article
looks like it should get you started:

http://www.codeproject.com/listctrl/lvcustomdraw.asp

-- 
Doug Harrison
Microsoft MVP - Visual C++
0
dsh (2498)
10/29/2003 9:56:06 PM
Reply:

Similar Artilces:

Help w/CListCtrl's NM_CUSTOMDRAW
How can you set the row height? I can do all sorts of things with this feature accept set the row height. http://www.codeguru.com/listview/change_row_height.shtml <anonymous@discussions.microsoft.com> wrote in message news:06dd01c39927$86a15480$a401280a@phx.gbl... > How can you set the row height? I can do all sorts of > things with this feature accept set the row height. ...

ActiveX and NM_CUSTOMDRAW
I have an ATL Composite Control (DLL) that that includes my own control (CMySlider) derived from CSliderCtrl. Here is the message map of this control. BEGIN_MESSAGE_MAP(CMySlider, CSliderCtrl) //{{AFX_MSG_MAP(CPlayerSlider) ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdraw) //}}AFX_MSG_MAP END_MESSAGE_MAP() When Composite Control is embedded in the Dialog or FormView, CMyControl receives notification, OnCustomdraw gets called and everything draws/works perfectly. The problem is that when the Composite Control is embedded in HTML page, I’m not receiving notification at all and instead of ...

NM_CUSTOMDRAW and LVS_OWNERDATA
Hi all, I have a question: I am using a virtual list control (LVS_OWNERDATA), and trying to handle the NM_CUSTOMDRAW message to draw something custom in one of the columns -- problem is, the NM_CUSTOMDRAW message only gets fired once for each item, rather than once for each column. Anyone know how to work around this? Thanks :) Casey This is normal behavior, you will need to draw the entire row when processing the NM_CUSTOMDRAW message. -- ============ Frank Hickman NobleSoft, Inc. ============ "Casey Langen" <avatar5d@hotmail.com> wrote in message news:yQQnb.17925$vi6.1...

Which is bester , LVS_OWNERDATA or LPSTR_TEXTCALLBACK ?
Hello , everyone. I see two approach that make application maintain data rather than the control. 1) Use LVS_OWNERDATA style: m_list.Create(WS_CHILD|WS_VISIBLE|LVS_REPORT|LVS_OWNERDATA,...); then handle the LVN_GETDISPINFO message. 2) NO LVS_OWNERDATA ! But set pszText member of LV_ITEM to LPSTR_TEXTCALLBACK, and handle LVN_GETDISPINFO message. like: LV_ITEM Item; Item.lParam = (LPARAM) pItem; // Store the pointer to the object Item.pszText = LPSTR_TEXTCALLBACK; // using callbacks to get the text Item.mask = LVIF_TEXT | LVIF_PARAM; // l...

CListCtrl and NM_CUSTOMDRAW
Hi all, I hopefully have simple problem. I have a CListCtrl with the LVN_GETDISPINFO and NM_CUSTOMDRAW styles set. I am custom drawing every item, and its very slow compared to letting windows do it. All I'm doing is FillSolidRect() to color the background of the item, then TextOut() to draw text to it. It should be noted that because of the LVN_GETDISPINFO style, NM_CUSTOMDRAW gets fired once per item, not once per subitem. Here is my code: void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult) { NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNM...

NM_CUSTOMDRAW and CListCtrl
Forgive me if this is a duplicate post. I'm using a CListCtrl with LVS_OWNERDATA and using NM_CUSTOMDRAW to draw the items myself, rather than letting windows do it -- however, this is quite slow. How does windows do it so fast, and why is my code so slow? Keep in mind that becuase of the LVS_OWNERDATA style, NM_CUSTOMDRAW is only fired once per item, not once per sub item, so when I get the event, I have to draw the entire row at one time. Heres the code: void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult) { NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDI...

LVS_OWNERDATA and NM_CUSTOMDRAW with CListCtrl == slow?
Forgive me if this is a near duplicate post... anyway, I'm trying to use NM_CUSTOMDRAW to draw all the items manually in a virtual CListCtrl (a list control with LVS_OWNERDATA). The problem is that my method is very slow and sluggish feeling compared to the way windows does it, and I don't know why. Keeping in mind that NM_CUSTOMDRAW is only fired once per item, due to the LVS_OWERDATA style, rather than once per sub item, perhaps someone can explain to me what I'm doing wrong? Heres the code: void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult) { NMLVDIS...

RE: NV_CUSTOMDRAW and LVS_OWNERDATA
This is normal behavior, you will need to draw the entire row when processing the NM_CUSTOMDRAW message. D0h. Thats the answer I was looking for :) Cheers! Casey ============ Frank Hickman NobleSoft, Inc. ============ "Casey Langen" <avatar5d@hotmail.com> wrote in message news:yQQnb.17925$vi6.10586@newssvr29.news.prodigy.com... > Hi all, I have a question: > > I am using a virtual list control (LVS_OWNERDATA), and trying to handle the NM_CUSTOMDRAW message to draw something custom in one of the columns -- problem is, the NM_CUSTOMDRAW message only gets fired once f...

CListCtrl and NM_CUSTOMDRAW mean no CreateDragImage?
I'm customizing my own list control and handling the drawing in custom draw. But when I use custom draw, I suddenly don't get a drag image anymore -- created by CreateDragImage. If I bypass the entire custom draw code (by returning a CDRF_DODEFAULT immediately) then it comes back. How can I handle the CreateDragImage and my custom draw code? (coding with VC++ .Net on an XP machine) david ...

LVS_OWNERDATA and LVM_ENABLEGROUPVIEW Not Compatible???
Hi, I have a list-view control that is working with groups quite well. However, when I turn on the LVS_OWNERDATA style, I can get everything working again BUT the groups. Does anyone know if this is unsupported? Can this be done? Any thoughts? Thanks, Anthony ...

LVS_OWNERDATA VS Label edit
How to implement item label edit in virtual list ctrl? I'v used SetItemText(...) in LVN_ENDLABELEDIT message handler, but got a assertion. Must I handle the label edit inside LVN_GETDISPINFO? On Wed, 9 Nov 2005 11:18:15 +0800, "liysh" <liysh@intertimes.com.cn> wrote: >How to implement item label edit in virtual list ctrl? >I'v used SetItemText(...) in LVN_ENDLABELEDIT message handler, but got a >assertion. >Must I handle the label edit inside LVN_GETDISPINFO? It doesn't make sense to use SetItemText in a virtual listview, because the listview doesn&...

CListCtrl, EnsureVisible and LVS_OWNERDATA style
Hi all, I have a CListCtrl in a DialogBox. This CListCtrl has the LVS_OWNERDATA style. I call the function Ensure visible to show a particular item, and I have two differents behaviours : - If I DO NOT click in the ListCtrl, then, it works fine, the list si scrolled to the correct item - If I click in the ListCtrl, then, any call to EnsureVisible scrolls the List to the first item. Does anybody have an idea to explain what is happening ? Ask for precisions if necessary. Thanks in advance, Dansk Oh dear... I found it, it was a stupid side effect. CListCtrl works fine in this case... ...

List View style LVS_EX_CHECKBOXES | LVS_OWNERDATA
LVS_EX_CHECKBOXES does not seem to work in combination with LVS_OWNERDATA. How can i fix that? ...

Need some answers regarding CListCtrl and LVS_OWNERDATA style (advanced)
Hi, I have created my own version of a CListView class where the embedded listctrl has the LVS_OWNERDATA style. I understand how to implement this style and have no problems creating / using this, apart from the fact it is SLOW!!! Below is what I am doing in the LVN_GETDISPINFO handler:- void CNewTharFrontView::OnGetdispinfoList(NMHDR* pNMHDR, LRESULT* pResult) { NMLVDISPINFO* pDispInfo = (NMLVDISPINFO*)pNMHDR; if(pDispInfo->item.mask & LVIF_TEXT) { GetItemText(pDispInfo->item.iItem, pDispInfo->item.iSubItem); strcpy(pDispInfo->item.pszText, m_sGetText); ...

LVS_OWNERDATA
Hi all, I want to use features supported in windows XP for CListCtrl as: Thumbnail, Insertion mark;.... Any one can tell me the way or share me experience? Thanks! ...