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.

Designer to format cells at runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

61840 Jun 4,2007 12:25 AM Jun 5,2007 06:24 PM Windows Forms 3
loading
Tags: GridControl
Vivek Vashisht
Asked On June 4, 2007 12:25 AM

Hi,

This is related to the configuration of cells at runtime.

We want the user to be able to select cells (not continuous cells but like in Excel user can select any number cells with Ctrl key) and then format the selected cells via some form of dialog box (provided by grid control).

There should be an option persist such format setting so that next time when user view/opens the control then format settings should be there.

The kind of format cells setting which we are expecting in dialog biox should be similar to what is provided by MS-Excel in Format Cells dialog box.

Can any body please tell me if all this can be achieved using grid control.

Thanks,
Vivek


Saravanan A [Syncfusion]
Replied On June 4, 2007 04:45 PM

Hi Vivek,

1, We want the user to be able to select cells and then format the selected cells via some form of dialog box
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please refer to this small sample that shows how formatting can be applied to the selected cells, similar to Excel.
http://websamples.syncfusion.com/samples/Grid.Windows/F61840/main.htm

2, There should be an option persist such format setting
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can achieve this serializing the grid to a file, while closing the application and reload it from the form load event.
Please refer to the serialization sample that was shipped with our product. You can find it from the following location.
"\Syncfusion\EssentialStudio\5.1.0.51\Windows\Grid.Windows\Samples\2.0\Serialization\GridControl\cs"

Best Regards,
Saravanan

Vivek Vashisht
Replied On June 5, 2007 07:19 AM

Saravanan,

Thanks for the reply. But I was looking for something like a built in designer (Excel like) for formatting the cells.
None-the-less now i want to try a different approach. I would like to select a few random cells, right click and click onto the format cells option. This opens up a modal window which has a property grid. I have set propertygrid.selectedobject = gridControl.
Q1 -> When I change any property in the propertygrid, the change gets applied to the whole of the grid rather than just the selected cells. How can I make the change implemented only to the selected cells?
Q2 -> In the example that you provided me in your reply, you are setting each style entity of the list when apply button is clicked. Which property(s) of the propertygrid exposes the style that i can collectively apply to the selected cells instead of setting individual properties of the style object in the entity?

thanks
vivek

>Hi Vivek,

1, We want the user to be able to select cells and then format the selected cells via some form of dialog box
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please refer to this small sample that shows how formatting can be applied to the selected cells, similar to Excel.
http://websamples.syncfusion.com/samples/Grid.Windows/F61840/main.htm

2, There should be an option persist such format setting
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can achieve this serializing the grid to a file, while closing the application and reload it from the form load event.
Please refer to the serialization sample that was shipped with our product. You can find it from the following location.
"\Syncfusion\EssentialStudio\5.1.0.51\Windows\Grid.Windows\Samples\2.0\Serialization\GridControl\cs"

Best Regards,
Saravanan

Saravanan A [Syncfusion]
Replied On June 5, 2007 06:24 PM

Hi Vivek,

Q1 -> How can I make the change implemented only to the selected cells?.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Try getting the combined style object for the selected cells using Model.GetCombinedStyle() method and asign it to the PropertyGrid.SelectedObject property.
Here is the code snippet.

GridRangeInfoList rangeList = null;
grid.Selections.GetSelectedRanges(out rangeList, true);
style = grid.Model.GetCombinedStyle(rangeList);
propertyGrid1.SelectedObject = style;


Q2 -> Which property(s) of the propertygrid exposes the style that i can collectively apply to the selected cells
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Try subscribe to the Changed event of the style object, that was asigned to the PropertyGrid and apply the changes to all the selected cells using Model.ChangeCells() method.

style.Changed += new StyleChangedEventHandler(GridStyleInfoChanged);
void GridStyleInfoChanged(object sender, StyleChangedEventArgs e)
{
if (!refreshPropertyGridNextIdle && range.Count != 0 && grid != null && style != null)
{
foreach (GridRangeInfo range in rangeList)
{
grid.Model.ChangeCells(range, style, StyleModifyType.Changes);
}
}
}


Best Regards,
Saravanan

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.

;