'LSVTBL - JB - Columns (0) .Width LSVTBL - JB - Clientsize.Width: "Microsoft Sans Serif"

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Dim SettingMatch As Boolean = False

Dim Matched As New List(Of ListViewItem)

Sub ListviewProperty()
LsVTbl_JB.View = View.Details
LsVTbl_JB.FullRowSelect = True
LsVTbl_JB.OwnerDraw = True
LsVTbl_JB.HeaderStyle = ColumnHeaderStyle.Nonclickable
LsVTbl_JB.MultiSelect = False
'LsVTbl_JB.Columns(0).Width = LsVTbl_JB.ClientSize.Width
LsVTbl_JB.Sorting = SortOrder.Ascending

End Sub
Private Sub LsVTbl_JB_DrawColumnHeader(ByVal sender As Object, ByVal e As
System.Windows.Forms.DrawListViewColumnHeaderEventArgs) Handles
LsVTbl_JB.DrawColumnHeader
e.Graphics.FillRectangle(Brushes.Aquamarine, e.Bounds)
Dim fnt As New Font("Microsoft Sans Serif", 9, FontStyle.Regular)
Dim sf As New StringFormat With {.Alignment = StringAlignment.Center,
.LineAlignment = StringAlignment.Center}
e.Graphics.DrawString(e.Header.Text, fnt, Brushes.Black, e.Bounds, sf)
e.Graphics.DrawRectangle(Pens.Olive, New Rectangle(e.Bounds.X, e.Bounds.Y,
e.Bounds.Width - 1, e.Bounds.Height - 1))
fnt.Dispose()
sf.Dispose()
End Sub
Private Sub LsVTbl_JB_DrawSubItem(ByVal sender As Object, ByVal e As
System.Windows.Forms.DrawListViewSubItemEventArgs) Handles LsVTbl_JB.DrawSubItem

e.DrawBackground()
Dim rFnt As New Font("Microsoft Sans Serif", 8, FontStyle.Regular)
Dim bFnt As New Font("Microsoft Sans Serif", 8, FontStyle.Bold)
Dim sf As New StringFormat With {.Alignment = StringAlignment.Near,
.LineAlignment = StringAlignment.Center}

If e.Item.Selected Then
e.Graphics.FillRectangle(Brushes.Aquamarine, e.Bounds)
e.Graphics.DrawString(e.SubItem.Text, bFnt, Brushes.Red, e.Bounds, sf)
e.Graphics.DrawRectangle(Pens.Black, New Rectangle(e.Bounds.X, e.Bounds.Y,
e.Bounds.Width - 1, e.Bounds.Height - 1))
Else
If Matched.Contains(e.Item) Then
e.Graphics.DrawString(e.SubItem.Text, bFnt, Brushes.Red, e.Bounds, sf)
Else
e.Graphics.DrawString(e.SubItem.Text, rFnt, Brushes.Black, e.Bounds, sf)
End If
End If
rFnt.Dispose()
bFnt.Dispose()
sf.Dispose()

End Sub

You might also like