Spread Silverlight Documentation
GetDrawingObjects Method
Example 


GrapeCity.Windows.SpreadSheet.UI Namespace > IDrawingObjectProvider Interface : GetDrawingObjects Method
The worksheet to get drawing objects.
The base row index.
The base column index.
The row count.
The column count.
Return a list of custom drawing objects.
Syntax
'Declaration
 
Function GetDrawingObjects( _
   ByVal sheet As Worksheet, _
   ByVal row As System.Integer, _
   ByVal column As System.Integer, _
   ByVal rowCount As System.Integer, _
   ByVal columnCount As System.Integer _
) As DrawingObject()
'Usage
 
Dim instance As IDrawingObjectProvider
Dim sheet As Worksheet
Dim row As System.Integer
Dim column As System.Integer
Dim rowCount As System.Integer
Dim columnCount As System.Integer
Dim value() As DrawingObject
 
value = instance.GetDrawingObjects(sheet, row, column, rowCount, columnCount)
DrawingObject[] GetDrawingObjects( 
   Worksheet sheet,
   System.int row,
   System.int column,
   System.int rowCount,
   System.int columnCount
)

Parameters

sheet
The worksheet to get drawing objects.
row
The base row index.
column
The base column index.
rowCount
The row count.
columnCount
The column count.
Example
This example uses the GetDrawingObjects method.
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; }
            }
        }
Public Sub New()
        InitializeComponent()
        GrapeCity.Windows.SpreadSheet.UI.DrawingObjectManager.SetDrawingObjectProvider(Me.gcSpreadSheet1, New MyDrawingObjectProvider())
    End Sub

    Public Class MyDrawingObjectProvider
        Implements GrapeCity.Windows.SpreadSheet.UI.IDrawingObjectProvider
        Public Function GetDrawingObjects(sheet As GrapeCity.Windows.SpreadSheet.Data.Worksheet, row As Integer, column As Integer, rowCount As Integer, columnCount As Integer) As GrapeCity.Windows.SpreadSheet.Data.DrawingObject() Implements GrapeCity.Windows.SpreadSheet.UI.IDrawingObjectProvider.GetDrawingObjects
            If row = 1 AndAlso column = 1 Then
                Return New ControlDrawingObject() {New ControlDrawingObject(row, column, New Button())}
            End If
            Return sheet.GetDrawingObject(row, column, rowCount, columnCount)
        End Function
    End Class

    Public Class ControlDrawingObject
        Inherits GrapeCity.Windows.SpreadSheet.UI.CustomDrawingObject
        Private _rootElement As Control
        Public Sub New(row As Integer, col As Integer, control As Control)
            MyBase.New(row, col)
            _rootElement = control
            Me.ShowDrawingObjectOnly = True
        End Sub
        Public Overrides ReadOnly Property RootElement() As FrameworkElement
            Get
                _rootElement.Margin = New Thickness(1)
                Return _rootElement
            End Get
        End Property
    End Class
See Also

Reference

IDrawingObjectProvider Interface
IDrawingObjectProvider Members