I have a weird problem and I don't know if this is the default behavior of the .NET DataGridView in GroupBox / TabControl.
I created a new WinForm project from scratch and created a GroupBox (changed the text style). Like this:
alt text http://www.freeimagehosting.net/uploads/65f5f2762d.png
Then I created a simple DataGridView, without a font style, for example:
alt text http://www.freeimagehosting.net/uploads/09f55f951a.png
Then, in development mode, I dragged the DataGridView inside the GroupBox, and this kind of magic just happened:
alt text http://www.freeimagehosting.net/uploads/d0334132f0.png
My question is: can I disable this behavior? The reason is, if I use the DataGridView style outside the GroupBox, and then drag it, I lost the whole style.
For the record only, this form has NO CODE in general.
Thanks in advance.
What you experience is called Environment Properties . In short, this is a mechanism in which a control will "inherit" some property values ββfrom its parent if properties are not explicitly assigned. I donβt know a way to prevent behavior other than assigning the desired values ββto the properties.
Try placing the panel in the group box, and then set the font property of the panel. Thus, the DataGridView inherits the properties of the panel. Much easier than setting each property of the DataGridView font.
Source: https://habr.com/ru/post/1303792/More articles:Code Portability C - cWho is compressing their HTML? - performanceIn PowerShell, how to write error, warning, write-host-output to a single file? - loggingproblem with virtual functions - c ++How many files can I open at once? - cHow to write a generator that returns ALL-BUT-LAST elements in iterable in Python? - pythonJQuery making div fadeout with timer - javascriptHow to determine if a value is ONE-BUT-LAST in a Python generator? - pythonLostFocus Binding not working on template - .netHow hard is it to try to make your SQL queries safe? - securityAll Articles