Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinForms - DataGridView Inherits style from GroupBox

I have a weird problem, and I don't know if this is the default behaviour of .Net DataGridView inside a GroupBox/TabControl.

I've 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've created a simple DataGridView, no font style at all, like this:

alt text http://www.freeimagehosting.net/uploads/09f55f951a.png

Then, in design mode, I dragged the DataGridView inside the GroupBox, and this sort of magic just happened:

alt text http://www.freeimagehosting.net/uploads/d0334132f0.png

My question is, can I disable this behaviour? Cause if I chage the DataGridView style outside the GroupBox and then drag it into, lost all the style.

Just for the record, this form has NO CODE at all.

Thanks in advance.

like image 201
Izzy Rodriguez Avatar asked Mar 11 '10 13:03

Izzy Rodriguez


1 Answers

Try putting a panel in the group box, then setting the font property of the panel. This way the DataGridView will inherit the properties of the panel. Much easier than setting every font property of the DataGridView.

like image 100
Malcolm Worthy Avatar answered Sep 20 '22 16:09

Malcolm Worthy