ousoonerjoe
Programmer
Using VB.Net 2010.
After wading through the swamp of MSDN files, I realized I've been traveling in circles all morning. When using a DataGridView, I want to allow the user to place a comment "under" the cell (storing it in the ToolTipText). I'd like to be able to adjust the cell's borders to indicate there is a comment in it. The following is what I'm trying to achieve, but failing miserably.
I've been using the following, but the refresh rates with it running in CellPainting are not playing well with others, which is why I want to move to actually setting the cell directly and not having to depend on the paint to do it. The grid is used for displaying scheduling information. (It's large and highly colorful).
--------------------------------------------------
Stubbornness is a virtue -- if you are right. --Chuck Noll
--------------------------------------------------
After wading through the swamp of MSDN files, I realized I've been traveling in circles all morning. When using a DataGridView, I want to allow the user to place a comment "under" the cell (storing it in the ToolTipText). I'd like to be able to adjust the cell's borders to indicate there is a comment in it. The following is what I'm trying to achieve, but failing miserably.
Code:
dgAsyLine.Rows(RowIndex).Cells(ColumnIndex).Style = DataGridViewCellBorderStyle.Raised
[COLOR=green]Generates Error: Error 1 Value of type 'System.Windows.Forms.DataGridViewCellBorderStyle' cannot be converted to 'System.Windows.Forms.DataGridViewCellStyle[/color]
I've been using the following, but the refresh rates with it running in CellPainting are not playing well with others, which is why I want to move to actually setting the cell directly and not having to depend on the paint to do it. The grid is used for displaying scheduling information. (It's large and highly colorful).
Code:
Private Sub dgAsyLine_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles dgAsyLine.CellPainting
If e.RowIndex > 0 And e.ColumnIndex > 0 Then
If dgAsyLine.Item(e.ColumnIndex, e.RowIndex).ToolTipText.Length > 0 Then
e.Paint(e.ClipBounds, e.PaintParts)
ControlPaint.DrawBorder3D(e.Graphics, e.CellBounds, Border3DStyle.Raised)
e.Handled = True
End If
End If
End Sub
--------------------------------------------------
Stubbornness is a virtue -- if you are right. --Chuck Noll
--------------------------------------------------