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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Recommended way to change font facename

Thread ID:





39825 Jan 19,2006 05:52 AM UTC Jan 19,2006 01:32 PM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On January 19, 2006 05:52 AM UTC

I need to apply a font to a range of cells. I''m starting out by just changing the font family (facename). I get a GridStyleInfoStoreTable, iterate through it and call store.SetValue(CellFontProperty, mygridfontinfo) on each item, and finish with calling gridmodel.SetCells(storetable). Unfortunately this doesn''t seem to work as I get a red exception cell and null reference exceptions logged. The above approach seems to work for back/fore color and cell value. Is there a correct way to change the facename while still using GridStyleInfoStore? Thanks.

Administrator [Syncfusion]
Replied On January 19, 2006 01:32 PM UTC

Hi Jim, Instead of changing through SetValue, try using ModifyStyle method. Here is the code snippet. if (this.gridControl1.Data[i, j] != null) { // this.gridControl1.Data[i, j].SetValue(GridStyleInfoStore.FontProperty, "Arial"); style.Font.Facename = "Arial"; style.Font.Bold = true; this.gridControl1.Data[i, j].ModifyStyle(style.Store, StyleModifyType.ApplyNew); } Refer to the sample for details Let us know if you need further assistance. Regards, Madhan.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon