Posted 29 July 2019, 11:05 pm EST
Hi Jitender,
I found the definitive workaround for now for me:
Private Sub ArticleIngredients_SetupEditor(sender As Object, e As RowColEventArgs) Handles ArticleIngredients.SetupEditor
With ArticleIngredients
If Not (e.Row < .Rows.Fixed) AndAlso e.Col = .Cols("fId").Index Then
If Not IsNothing(.Editor) Then
Dim cb As ComboBox = DirectCast(.Editor, ComboBox)
cb.RightToLeft = If(SqlIsRTLLanguage(Me.LanguageID), RightToLeft.Yes, RightToLeft.No)
AddHandler cb.DrawItem, AddressOf ComboBox_DrawItem
End If
End If
End With
End Sub
Private Sub ComboBox_DrawItem(sender As Object, e As DrawItemEventArgs)
Dim cb As ComboBox = DirectCast(sender, ComboBox)
If (cb.RightToLeft = RightToLeft.Yes) Then
Dim C1FG As C1FlexGrid = DirectCast(cb.Parent, C1FlexGrid)
e.DrawBackground()
e.Graphics.FillRectangle(New SolidBrush(If((e.State And DrawItemState.Selected) = DrawItemState.Selected, C1FG.Styles.Highlight.BackColor, e.BackColor)), e.Bounds)
e.Graphics.DrawString(cb.Items(e.Index).ToString, e.Font, New SolidBrush(If((e.State And DrawItemState.Selected) = DrawItemState.Selected, C1FG.Styles.Highlight.ForeColor, e.ForeColor)), e.Bounds, New StringFormat(StringFormatFlags.DirectionRightToLeft))
If ((e.State And DrawItemState.Selected) = DrawItemState.Selected) Then ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds)
End If
End Sub
The ComboBox associated with the grids Editor when a column has a DataMap assigned, has DrawMode = OwnerDrawVariable, so a DrawItem event will fire when added...