BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Public Class DataGridColoredTextBoxColumn Inherits DataGridTextBoxColumn Private column As Integer ' column where this columnstyle is located... Public Sub New() column = -2 End Sub Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean) Try Dim grid As DataGrid = Me.DataGridTableStyle.DataGrid 'first time set the column properly If column = -2 Then Dim i As Integer i = Me.DataGridTableStyle.GridColumnStyles.IndexOf(Me) If i > -1 Then column = i End If End If If grid.CurrentRowIndex = rowNum And grid.CurrentCell.ColumnNumber = column Then backBrush = New LinearGradientBrush(bounds, Color.FromArgb(255, 200, 200), Color.FromArgb(128, 20, 20), LinearGradientMode.BackwardDiagonal) foreBrush = New SolidBrush(Color.White) End If Catch ex As Exception ' empty catch Finally ' make sure the base class gets called to do the drawing with ' the possibly changed brushes MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight) End Try End Sub Protected Overloads Overrides Sub Edit(ByVal source As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean) ' do nothing... dont call baseclass End Sub End Class