29 lines
1.2 KiB
VB.net
29 lines
1.2 KiB
VB.net
Imports DevExpress.XtraEditors
|
|
Imports DevExpress.XtraGrid
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
|
|
Public Class GridFunctions
|
|
Public Shared Function CreateFormatRule(ByRef grdv As GridView, Column As String, ApplyToRow As Boolean, Condition As DevExpress.XtraEditors.FormatCondition, value1 As Object, Optional value2 As Object = Nothing, Optional backcolor As Color = Nothing, Optional fontstyle As FontStyle = Nothing) As GridFormatRule
|
|
Dim rule As New GridFormatRule
|
|
rule.Column = grdv.Columns(Column)
|
|
rule.ApplyToRow = ApplyToRow
|
|
rule.Rule = New FormatConditionRuleValue With {
|
|
.Condition = Condition,
|
|
.Value1 = value1,
|
|
.Value2 = value2
|
|
}
|
|
If backcolor <> Nothing Then rule.RuleCast(Of FormatConditionRuleValue).Appearance.BackColor = backcolor
|
|
If fontstyle <> Nothing Then rule.RuleCast(Of FormatConditionRuleValue).Appearance.FontStyleDelta = fontstyle
|
|
|
|
Return rule
|
|
End Function
|
|
|
|
Public Shared Sub EndGridEdit(grdv As DevExpress.XtraGrid.Views.Grid.GridView)
|
|
If grdv.FocusedRowHandle <> DevExpress.XtraGrid.GridControl.NewItemRowHandle Then
|
|
grdv.CloseEditor()
|
|
grdv.UpdateCurrentRow()
|
|
End If
|
|
End Sub
|
|
|
|
End Class
|