Link to home
Start Free TrialLog in
Avatar of prowebinteractiveinc
prowebinteractiveinc

asked on

.NET changing the font of the text in a DataGridView

I am trying to reduce the font size in the DataGridView for all the colomns
Avatar of nkish
nkish
Flag of United States of America image

You can create an element in your CSS with the font properties (including the size) and then reference the element in the DataGridView control (using the CssClass property).
Unless I misunderstand your question, all you would need to do is:

<asp:GridView ID="gridview1" runat="server" font-size="12"... />

All you would need is change font-size to whatever you need
Avatar of Bob Learned
Names for grids can be confusing without more detail, as DataGridView is typically a Windows Forms name, and GridView is typically an ASP.NET name.
If it is windows as TheLearnedOne indicated, then this link would do:

http://stackoverflow.com/questions/64041/winform-datagridview-font-size
Avatar of prowebinteractiveinc
prowebinteractiveinc

ASKER

Im working with windows forms
If you set the Font property for the DataGridView, then it should apply to all the elements (headers, cells, etc.).  If you cell the Font property for a column, then it should just apply to the cells.

You can also handle the CellFormatting or CellPainting event handlers, and do special formatting for the DataGridView.
but what about specific rows at a time example

I have a list of invoices invoices 0-29 days old are black, 30-59 are blue, 60-89 yellow, 90+ red
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial