Question Insert icon In ListView Column Header

sonia.sardana

Active member
Joined
Jan 25, 2009
Messages
35
Programming Experience
Beginner
hello frnds,I m able to insert the icon in ListView Column Header..
Steps-1) Drag the Imagelist.
2) Insert the iamges into the imagelist.
3)Associate the SmallImageList Property of Listview to Imagelist Name.

VB.NET:
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim lCount As Integer
        Dim lvitem As ListViewItem

        ListView1.Columns(0).ImageIndex = 0
        For lCount = 1 To 5
            lvitem = ListView1.Items.Add(lCount)
            lvitem.SubItems.Add("sonia" & lCount)
            Application.DoEvents()
        Next

    End Sub

    Private Sub ListView1_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView1.ColumnClick
        If e.Column = 0 Then
            Select Case ListView1.Columns(0).ImageIndex
                Case 0
                    ListView1.Columns(0).ImageIndex = 1
                Case 1
                    ListView1.Columns(0).ImageIndex = 0
            End Select
        End If
    End Sub

When I click on ListView Column Headre..Image Changes Vice-Versa
.

Icon is inserted to the left of the text in Column Header..(See in Pic)..I want the icon to be inserted at the right & text at the left..

What to do??Plz help me out?/
 

Attachments

  • Pic.JPG
    Pic.JPG
    18 KB · Views: 30
Back
Top