G
Guest
I am creating a linklabel look-a-link in a datagrid with the following code
by overriding the paint sub:
If column = 0 Or column = 3 Or column = 4 Then
Dim UnderlineFont As New
Font(Me.DataGridTableStyle.DataGrid.Font, FontStyle.Underline)
Dim rect As Rectangle = bounds
Dim value As Object = GetColumnValueAtRow(source, rowNum)
g.FillRectangle(backBrush, rect)
g.DrawString(value.ToString, UnderlineFont, Brushes.Blue,
RectangleF.FromLTRB(rect.X, rect.Y, rect.Right, rect.Bottom))
Else
MyBase.Paint(g, bounds, source, rowNum, backBrush,
foreBrush, alignToRight)
End If
I only create the linklabel look-alike in specific rows and columns. Now I
have to have the cursor change to a 'hand' when the mouse moves over a cell.
Note! I am creating the datagrid programmatically so I do not know what rows
will contain a link (so I can not use the example by George Shepard in
sycfusion). Also, there is NOT a mouseup or mousedown event to work with. I
only want the cursor to change to a hand on a specific cell, not a whole row.
I have been trying to do with with the datagrid.hittestinfo but can't seem
the to get it.
Thanks!
by overriding the paint sub:
If column = 0 Or column = 3 Or column = 4 Then
Dim UnderlineFont As New
Font(Me.DataGridTableStyle.DataGrid.Font, FontStyle.Underline)
Dim rect As Rectangle = bounds
Dim value As Object = GetColumnValueAtRow(source, rowNum)
g.FillRectangle(backBrush, rect)
g.DrawString(value.ToString, UnderlineFont, Brushes.Blue,
RectangleF.FromLTRB(rect.X, rect.Y, rect.Right, rect.Bottom))
Else
MyBase.Paint(g, bounds, source, rowNum, backBrush,
foreBrush, alignToRight)
End If
I only create the linklabel look-alike in specific rows and columns. Now I
have to have the cursor change to a 'hand' when the mouse moves over a cell.
Note! I am creating the datagrid programmatically so I do not know what rows
will contain a link (so I can not use the example by George Shepard in
sycfusion). Also, there is NOT a mouseup or mousedown event to work with. I
only want the cursor to change to a hand on a specific cell, not a whole row.
I have been trying to do with with the datagrid.hittestinfo but can't seem
the to get it.
Thanks!