Developed by winform, The gridcontrol control in devexpress is used. The default header is a 3D style. If you want to flat the display like the content and add a vertical line (Right Border ),
The nightmare started ..
After a burst of exploration, we found that the solution can be as follows:
1. Set the paintstylename attribute of the gridcontrol's gridview control to Web
2. Add the customdrawcolumnheader event to the gridview control of gridcontrol. The reference code is as follows:
Private void gridview1_mdrawcolumnheader (Object sender, columnheadercustomdraweventargs e) {If (E. column = NULL) return; E. painter. drawobject (E. info); Using (PEN p1 = new pen (color. fromargb (227,227,227), 2) {e. graphics. drawline (P1, E. bounds. X + E. bounds. width, E. bounds. y-2, E. bounds. X + E. bounds. width, E. bounds. Y + E. bounds. height + 2 );}}
Note: color. fromargb (227,227,227) is the color value of the vertical line.
At this time, if the bordercolor of the headerpanel under the appearance attribute in the gridview is set, there will be some gaps in the set color value.
Therefore, it is best to set the color in the event, and there is a little highlight, which should not be affected.