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

Font changes

I need to know when the font has changed for individual cells. There is a FontChanged event for the grid as well as one for the styles, but there''s not much documentation for it. There doesn''t appear to be any way to tell where the change is taking place. In my particular case, I need to resize rows to accomodate the largest font in the row. What event and from which object should I be handling? The GridStyleInfo doesn''t really make sense because that will only apply to styles I know about (unless I handle events for styles being added and removed and add and remove FontChanged event handlers as needed, but that seems overly complex. Thanks. Pete

3 Replies

AD Administrator Syncfusion Team June 4, 2004 07:36 AM

Any time a style changes, the events CellsChanging, SaveCellInfo, and CellsChanged are raised. You would have to identify when a style.Font was changed in one of these events. Here is a snippet that does it in SaveCellInfo.
private void gridControl1_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
{
	if(e.Style.Store.IsValueModified(GridStyleInfoStore.FontProperty))
	{
		Console.WriteLine("Font changed");
	}
}


PD Pete Davis June 4, 2004 07:41 AM

Thanks Clay. Since I may be resizing the row, I guess it would make more sense to do it on the CellsChanging event, since the row size change would start the whole event process over, correct? >Any time a style changes, the events CellsChanging, SaveCellInfo, and CellsChanged are raised. > >You would have to identify when a style.Font was changed in one of these events. Here is a snippet that does it in SaveCellInfo. > >
>private void gridControl1_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
>{
>	if(e.Style.Store.IsValueModified(GridStyleInfoStore.FontProperty))
>	{
>		Console.WriteLine("Font changed");
>	}
>}
>


AD Administrator Syncfusion Team June 4, 2004 08:03 AM

CellChanging would allow you to look at several cells at one time provided the change to the styles were done with a grid.ChangeStyles call. If it is done some other way, it will probably not make a difference.

Loader.
Live Chat Icon For mobile
Up arrow icon