By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,260 Members | 1,344 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,260 IT Pros & Developers. It's quick & easy.

Windows Form DataGrid - Need A Color Border Around Only The Selected Row - Will GDI Be Required

P: n/a
I 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.

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
news:hT*********************@twister.nyc.rr.com...
I 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.


Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.