Rounded Corners On A DataGridView

0
0

Hello Support.

From an answer to an earlier question about rounded corners (on a button) the advice was to use:

this.button1.CssStyle=”border-radius:5px”;

This works well for buttons but when I set the same CssStyle on a DataGridView only the bottom two corners are rounded. The top two corners remain square. It looks like the column label row does not listen to the CssStyle. Is there any way around this ? Any easy way to get a DataGridView with all 4 corners rounded ?

Thank you

Andrew


            
  • You must to post comments
0
0

Hello Julie.

Thank you for your answer, I put the css line into the theme file that I use but only have partial success with it. When I have a datagridview with no data and no column headers I can see the nice rounded corners on all 4 corners, looks good !. But when I have a row of data in the datagridview the row does not have rounded corners and, on screen, overwrites the datagridview border and gives it square corners. Likewise if I have column headers – the column header row has square corners and you can’t see the rounded corners of the datagridview anymore. I have attached an image which might make things clearer.

Andrew

  • Andrew Pearce
    I have been checking this out some more and found that when I changed the theme in my web-config to a standard theme the rounded corners all worked – with or without data and with or without column headers. I have been using a theme file that was based on one of the Blue-* themes that I have made changes to over the last few years. I will try to work out what in my theme is stopping the rounded corners working, or maybe just start again from a working theme and try to apply my other changes again. Thanks for your help Julie.
  • You must to post comments
0
0

You can do this via a theme/ theme mixin.

This is the code you need:
"css": "{\"border-radius\":\"5px\"}"

You need to use this in the “table” like so:
"table": {
"states": {
"default": {
"styles": {
"width": [1, 1, 1, 1],
"style": ["solid", "solid", "solid", "solid"],
"color": "windowFrame",
"css": "{\"border-radius\":\"5px\"}"
},
"properties": {
"indent": 20,
"rowHeight": 32,
"headerCellHeight": 32,
"backgroundColor": "window",
"headerBackColor": "window"
}
},

I’ve attached the full theme file (it’s a modified version of the Bootstrap=4 theme) and a screenshot of what this looks like on the datagridview in the theme builder.

Hope this helps,
Julie

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.