public MainPage()
{
InitializeComponent();
GrapeCity.Windows.SpreadSheet.UI.DrawingObjectManager.SetDrawingObjectProvider(this.gcSpreadSheet1, new MyDrawingObjectProvider());
}
public class MyDrawingObjectProvider : GrapeCity.Windows.SpreadSheet.UI.IDrawingObjectProvider
{
public GrapeCity.Windows.SpreadSheet.Data.DrawingObject[] GetDrawingObjects(GrapeCity.Windows.SpreadSheet.Data.Worksheet sheet, int row, int column, int rowCount, int columnCount)
{
if (row == 1 && column == 1)
{
return new ControlDrawingObject[] { new ControlDrawingObject(row, column, new Button()) };
}
return sheet.GetDrawingObject(row, column, rowCount, columnCount);
}
}
public class ControlDrawingObject : GrapeCity.Windows.SpreadSheet.UI.CustomDrawingObject
{
private Control _rootElement;
public ControlDrawingObject(int row, int col, Control control) : base(row, col) { _rootElement = control; this.ShowDrawingObjectOnly = true; }
public override FrameworkElement RootElement
{
get { _rootElement.Margin = new Thickness(1); return _rootElement; }
}
}