Adding up or down arrow to Listview column headings

Is there a way to display a graphical up or down arrow in a ListView column heading to indicate which way the column is sorted? Or can I color the pixels within the ListView column heading another color? So, if I have a column of width 125 (lvc.cx = 125) and lvc.pszText = "Type", I would like to have an arrow to the right of "Type" to indicate which way the column is sorted. If I could change pixel colors within the column header, I think that would get me there.
I tried adding unicode \x18 and \x19 to my text, but you can't see it very well.
Looking at the Unicode table, there are numerous arrows. That works great, but any unicode symbol > 4 doesn't work. My compiler says 'too large of a number'. But, I found one that will work. However, I can't put it where I want to. It would be nice to be able to color pixels within the ListView column header so I could move it over slightly.
It might help if you could post
- which version of ListView, because pretty much every GUI out there has their own version. Even M$ has several depending on whether you're using regular Win32 or .NET.
- what compiler you're using
- some actual code snippets which show the error.
- some actual error messages (not paraphrased).
Visual Studio version 17.0.5

TextOutW(hdc,200,280,L"\x1F815",1); // up arrow gives Error code C2188 "too big for wide character"
TextOutW(hdc,200,280,L"\U0001F815",2); // compiles but doesn't print correctly
TextOutW(hdc,200,280,L"\x25B2",1); // this up arrow works great

How can I print larger unicode characters?
Last edited on
W (and L) in windows is for 'Wide-char' which in windows-speak is of underlying type wchar_t which is 16 bits. Hence the warning re x1F815 as it's greater than 0xFFFF. Also, that's why x25B2 works - as it's smaller than 0xFFFF.

So, how do you print a x1F815 arrow code? Is there a TextOut function that takes longer than a W?
MFC / basic windows only supports 16 bit unicode (UTF16)
I don't know if there is an add-on library or if managed libraries support 32 or not; I have not needed it.

You should be able to over-ride the font size somewhere.
if that does not work like you want, you can owner-draw the frame yourself and do whatever you like.
Last edited on
How can I print larger unicode characters?
I guess it's utf8? For how to convert it to utf16/Unicode see:

https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar
hes asking for a 3 byte symbol.
Last edited on
It might be utf 32. For utf 16 see:

https://www.fileformat.info/info/charset/UTF-16/list.htm
Topic archived. No new replies allowed.