terimakasih mas aries, uda bisa, aku juga mau coba merubah warna baris yang sesua kriteria misalkan jika ID 001 sudah ada di database maka warna background list view nya berubah. gimana caranya mas??
Thx hendra ----- Original Message ---- From: aries <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, June 18, 2007 2:18:26 PM Subject: Re: [indoprog-vb] Tanya List View Row berwarna Standarnya sih listview emang enggak nyediain properti untuk ngeset warna barisnya, tapi kita bisa buat sendiri prosedure untuk ngeset warna barisnya dengan memanfaatkan properti picturenya, selain itu kita juga membutuhkan objek picturebox ini cuplikan kodenya : Private Sub setRowColorListView (ByVal pic As PictureBox, ByVal lst As ListView) Dim i As Long pic.BackColor = lst.BackColor pic.ScaleMode = vbTwips pic.BorderStyle = vbBSNone pic.AutoRedraw = True pic.Visible = False pic.Width = lst.Width pic.Height = lst.ListItems( 1).Height * (lst.ListItems. Count) pic.ScaleHeight = lst.ListItems. Count pic.ScaleWidth = 1 pic.DrawWidth = 1 pic.Cls For i = 1 To lst.ListItems. Count If i Mod 2 = 0 Then 'warna putih pic.Line (0, i - 1)-(1, i), RGB(255, 255, 255), BF Else pic.Line (0, i - 1)-(1, i), RGB(239, 239, 239), BF End If Next lst.Picture = pic.Image End Sub untuk ngeset warna tulisannya pake yang ini : Private Sub setFontColorListVie w(ByVal lst As ListView, ByVal iRow As Long, ByVal warna As Long) Dim iCol As Byte With lst .ListItems(iRow) .ForeColor = warna .ListItems(iRow) .Bold = True For iCol = 1 To lst.ColumnHeaders. Count - 1 .ListItems(iRow) .ListSubItems. Item(iCol) .ForeColor = warna .ListItems(iRow) .ListSubItems. Item(iCol) .Bold = True Next .Refresh End With End Sub Private Sub Command1_Click( ) Call setRowColorListView (Picture1, ListView1) End Sub Private Sub Command2_Click( ) '3 -> baris yang ingin diset warnanya misal merah Call setFontColorListVie w(ListView1, 3, vbRed) End Sub selamat mencoba :) hendra putra <[EMAIL PROTECTED] com> wrote: siang VB'ers Gimana Cara memberi warna list view per row, jadi row genap dan ganjil beda warna, saya gunakan list view tipe reportlist .trus kalo colom id sudah ada tersimpan datanya saya ingin untuk merubah warna tulisanya warna merah baris yang bersangkutan. .. gimana caranya tolong dong. THX hendra ____________ _________ _________ _________ _________ _________ _ Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. http://new.toolbar. yahoo.com/ toolbar/features /mail/index. php [Non-text portions of this message have been removed] ------------ --------- --------- --- Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. [Non-text portions of this message have been removed] ____________________________________________________________________________________ Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC [Non-text portions of this message have been removed]
