We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Virtual Grid Font

I have a number of virtual grids where I would like to set the font for all the cells programatically. When I try the following code I get a runtime exception: this.vgTests.BaseStylesMap["Standard"].StyleInfo.Font = new GridFontInfo(font); There seems to be a number of places to specify fonts when using a virtual grid in the designer. Please advise as to the best way to change manipulate grid fonts from code. Thanks.

3 Replies

AD Administrator Syncfusion Team May 30, 2005 02:03 AM UTC

Try code like: Font f = new Font("Courier", 14, FontStyle.Bold|FontStyle.Italic); this.gridControl1.BaseStylesMap["Standard"].StyleInfo.Font.ModifyStyle(new GridFontInfo(f), Syncfusion.Styles.StyleModifyType.Changes);


KL Ken Law June 8, 2005 11:48 PM UTC

I put your code sample in the constructor of the control that hosts the GridControl so it runs after InitializeComponent. InitializeComponent contains the following code for the GridControl''s font property generated by the Property Browser. The font property code seems to take precedence over setting the Standard style in the BaseStylesMap. Can you tell me the relationship between the grid''s font property and the styles? I would like to be able to control the font of row and column headers independently of the cell fonts. Thanks.


AD Administrator Syncfusion Team June 9, 2005 01:19 AM UTC

>>I would like to be able to control the font of row and column headers independently of the cell fonts. The row and column styles (fonts) are controlled by grid.baseStylesMap["Row Header"].StyleInfo.Font and grid.baseStylesMap["Column Header"].StyleInfo.Font. Th etop-left cell is controlled by grid.baseStylesMap["Header"].StyleInfo.Font.

Loader.
Live Chat Icon For mobile
Up arrow icon