|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Windows Form DataGrid - Need A Color Border Around Only The Selected Row - Will GDI Be RequiredI have a lot of colors, fonts, etc. to set for rows and possibly columns,
based on the information contained in the row and/or the selected row. A main one is putting a border around the entire selected row only. The border one does not seem to be simple thing to do by just setting a property of the grid, DataGridTableStyle, GridColumnStyle, etc. It seems to require GDI stuff like Paint, Brush, Region, Rectangle, etc. Is there an easier way than all this custom GDI programming. If custom programming is involved is there anyone who has sample of a nice orderly, well structured object with best practices properties, methods, etc. to do this type of thing? Or, failing that a good book recommendation. Not a book that is really geared to heavy graphics but something like what I'm looking to do with the DataGrid. Hi,
Maybe selecting the row will work for you. Dim conn As SqlConnection Dim strConn As String Dim strSQL As String Dim da As SqlDataAdapter Dim ds As New DataSet strConn = "Server = (local);" strConn &= "Database = NorthWind;" strConn &= "Integrated Security = SSPI;" conn = New SqlConnection(strConn) da = New SqlDataAdapter("Select * From Products", conn) da.Fill(ds, "Products") DataGrid1.DataSource = ds.Tables("Products") For x As Integer = 0 To ds.Tables("Products").Rows.Count - 1 Dim dr As DataRow = ds.Tables("Products").Rows(x) If CInt(dr.Item("UnitsInStock")) < 5 Then DataGrid1.Select(x) Next Ken ----------------------- "Richard" <a@b.com> wrote in message I have a lot of colors, fonts, etc. to set for rows and possibly columns,news:hTJ0e.43352$rB3.7509081@twister.nyc.rr.com... based on the information contained in the row and/or the selected row. A main one is putting a border around the entire selected row only. The border one does not seem to be simple thing to do by just setting a property of the grid, DataGridTableStyle, GridColumnStyle, etc. It seems to require GDI stuff like Paint, Brush, Region, Rectangle, etc. Is there an easier way than all this custom GDI programming. If custom programming is involved is there anyone who has sample of a nice orderly, well structured object with best practices properties, methods, etc. to do this type of thing? Or, failing that a good book recommendation. Not a book that is really geared to heavy graphics but something like what I'm looking to do with the DataGrid.
Other interesting topics
|
|||||||||||||||||||||||