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.
Unfortunately, activation email could not send to your email. Please try again.

Recommended way to change font facename

Thread ID:

Created:

Updated:

Platform:

Replies:

39825 Jan 19,2006 12:52 AM Jan 19,2006 08:32 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 19, 2006 12:52 AM

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 08:32 AM

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.

Forum_39825.zip

CONFIRMATION

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.

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.

;