Current filter:
                                You should refresh the page.
                                  • [DevExpress Support Team: CLONED FROM T829410: XtraGrid - Column headers do not display multiline text in DirectX mode]

                                    Hi Pavel,

                                    So much appreciated on your assistance. It works.

                                    Currently am facing one more difficulties, that when i switch to "Office 2019 Black" theme, then the GridControl_PaintEx, e.Cache.DrawLine    color get's WHITE and it's doesn't looks good. But in "Visual Studio 2013 Dark" it's works. Also tested on "Basic" theme the same issue is occurring.

                                    I have attached a little clip and the modified project for your quick/easy understanding. Awaiting your kind reply.

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Bhabani,

                                Thank you for the sample project. The cause of this behavior is the difference between the way the skin color is determined in raster and vector skins. Use the element.Color.GetBackColor method instead of reading the BackColor property directly:

                                Private Sub GridControl_PaintEx(sender As Object, e As PaintExEventArgs) ''''' Dim pen As Pen = New Pen(element.Color.GetBackColor())

                                This way, everything will work as expected regardless of the active skin.

                                By the way, determining the skin element color in the PaintEx event handler is not resource effective. Instead, I recommend you cache the corresponding pen in a separate field. Then, use the LookAndFeel.StyleChanged event to catch the moment when the active skin changes to update this pen. I updated your project to show how to do this. I hope it will be helpful.

                                Show all comments
                                • Bhabani Shanakar Dash 11.07.2019

                                  Hi Pavel,

                                  So much thanks for update the sample and the approach. Having 2 things want's to know:

                                  1: Assume, if i will not want to change the Skin during Run Time, then "LookAndFeel.StyleChanged event" is not required ? Can i use the previous simple way i.e "Dim pen As Pen = New Pen(element.Color.GetBackColor())". I mean to say i will set the Skin at startup only and during runtime i will never change the Skin at all.

                                  2: In event "gridView1_CustomDrawColumnHeader" already i have set the "sf.Alignment = StringAlignment.Center" , but still the Column Text are not center. I have attached a video clip for the same and looks your assistance please.

                                • Pavel (DevExpress Support) 11.07.2019

                                  Hi Bhabani,

                                  1. You are right, if you don't plan to switch between skins at runtime, you don't have to handle the StyleChanged event. It is sufficient to create a pen with the proper color and use it in the PaintEx event handler.
                                  2. Judging by your video, you mean that column caption is not vertically centered. Set the StringFormat's LineAlignment to StringAlignment.Center as well to center the string vertically within given bounds:
                                  Dim sf As StringFormat = New StringFormat() sf.Alignment = StringAlignment.Center sf.LineAlignment = StringAlignment.Center e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect, sf) e.Handled = True
                                • Bhabani Shanakar Dash 11.08.2019

                                  Hi Pavel,

                                  Appreciated on your reply. Great effort to share the solution. It works.

                                • Bhabani Shanakar Dash 11.09.2019

                                  Hi Pavel,

                                  One little odd things appears/painting if i Freeze a column. Please find the screenshot. Do you have any solution for me.

                                  GridView1.Columns.ColumnByFieldName("ID").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left

                                • Pavel (DevExpress Support) 11.11.2019

                                  Hello Bhabani,

                                  From what I gather, you would like to render the fixed column divider line using the same color as other column lines. In this case, you need to draw the line from the top of the grid row rectangle (currently you are rendering only the line in the empty grid area). So, the code for columns fixed to the left should look as follows:

                                  If ((Not rects.FixedLeft.IsEmpty)) Then e.Cache.DrawLine(pen, New Point(rects.FixedLeft.Right - view.FixedLineWidth, rects.Rows.Top), New Point(rects.FixedLeft.Right - view.FixedLineWidth, er.Bottom)) End If

                                  The code for the right-fixed columns should be updated in the same manner.

                                • Bhabani Shanakar Dash 11.11.2019

                                  Hello Pavel,

                                  You are absolutely correct and thanks for the achievement. Wish your technical support once again.