How to set the alignment of items of CListCtrl
-
I want to set the alignment of the items only and not for the header. I tried with SetColumn with LVCFMT_RIGHT but that aligns header also. I just want to align only the items(header should be skipped) I also thought that SetItem should work for aligning only a single item but I don't know how it can be used for aligning a single item.
-
I want to set the alignment of the items only and not for the header. I tried with SetColumn with LVCFMT_RIGHT but that aligns header also. I just want to align only the items(header should be skipped) I also thought that SetItem should work for aligning only a single item but I don't know how it can be used for aligning a single item.
According to the documentation[^] alignment affects both header and content. The only way I can think to work round this would be to make it owner drawn and catch the
WM_DRAWITEM
message[^] to draw the items yourself.One of these days I'm going to think of a really clever signature.
-
According to the documentation[^] alignment affects both header and content. The only way I can think to work round this would be to make it owner drawn and catch the
WM_DRAWITEM
message[^] to draw the items yourself.One of these days I'm going to think of a really clever signature.
Thanks Richard, I am going to give it a try. I searched for the example for this and found this http://msdn.microsoft.com/en-us/library/kc9hahtd(v=vs.80).aspx[^] Can you refer any other examples? I am new to OwnerDraw. This is what I got about ownerdraw. http://msdn.microsoft.com/en-us/library/windows/desktop/hh298352(v=vs.85).aspx[^]
-
Thanks Richard, I am going to give it a try. I searched for the example for this and found this http://msdn.microsoft.com/en-us/library/kc9hahtd(v=vs.80).aspx[^] Can you refer any other examples? I am new to OwnerDraw. This is what I got about ownerdraw. http://msdn.microsoft.com/en-us/library/windows/desktop/hh298352(v=vs.85).aspx[^]
-
That first link looks like it is the answer to your question, give it a try and then modify to your specific requirements.
One of these days I'm going to think of a really clever signature.
Thanks a lot. That worked. It aligned the text as I expected but few items could not be drawn, I guess I have to skip where the item type is image instead of text. Or may be I have to set the image also. I am working on it. I had used lvs_ownerdrawfixed. Thanks, Rahul Kulshreshtha
-
Thanks a lot. That worked. It aligned the text as I expected but few items could not be drawn, I guess I have to skip where the item type is image instead of text. Or may be I have to set the image also. I am working on it. I had used lvs_ownerdrawfixed. Thanks, Rahul Kulshreshtha
In general the items in a list control consist of a text description and an image. If you use images then you would normally have one for every item. Take a look at Windows explorer and switch between the various views to see how the 'standard' displays are laid out.
One of these days I'm going to think of a really clever signature.