Hello John,
Thanks for using Microsoft Newsgroup Support Service, my name is Colbert
Zhou [MSFT] and I will be working on this issue with you.
In order to display an up or down arrow right beside the ListView control
header. We need to draw it ourselves. The approach is setting OwnerDraw
property to true and register the following three events, DrawColumnHeader,
DrawItem, DrawSubItem.
The implementations of these event handles are,
Private Sub ListView1_DrawColumnHeader(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.DrawListViewColumnHeaderEventArgs) Handles
ListView1.DrawColumnHeader
e.DrawBackground()
e.DrawText()
Dim uparrowFont As New Font("Calibri", 8)
Dim uparrow As New String(New Char()
{Microsoft.VisualBasic.ChrW(&H2191)})
e.Graphics.DrawString(uparrow, uparrowFont, New
SolidBrush(Color.Black), e.Bounds.Right - 15, 1)
End Sub
Private Sub ListView1_DrawItem(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.DrawListViewItemEventArgs) Handles
ListView1.DrawItem
e.DrawDefault = True
End Sub
Private Sub ListView1_DrawSubItem(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.DrawListViewSubItemEventArgs) Handles
ListView1.DrawSubItem
e.DrawDefault = True
End Sub
In DrawItem and DrawSubItem, we set the e.DrawDefault to true which lets
the system to draw them. And in the DrawColumnHeader event, we call
DrawBackground and DrawText to draw the default text and background. And
then we call DrawString to draw an Unicode up arrow at the end of the
header bound.
Please let me know if this helps for your scenario. And if you have any
future questions or concerns, just let me know! I will try my best to
provide future assistances. Have a nice day!
Best regards,
Colbert Zhou (colbertz @online.microsoft.com, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.