Click or drag to resize

Sheet Class

A Sheet is a host for visual elements.
Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    System.Runtime.InteropServicesStandardOleMarshalObject
      BaseObject
        Wrapper
          Easymap.AddIn.CommonLTComponent
            Easymap.AddInSheet

Namespace: Easymap.AddIn
Assembly: EasyMap.AddIn (in EasyMap.AddIn.dll) Version: 12.3.0.0
Syntax
public sealed class Sheet : LTComponent, 
	IWin32Window, IDocumentProperty, IDynamicMetaObjectProvider

The Sheet type exposes the following members.

Properties
 NameDescription
Public propertyClientBounds The Bounds of the map control
Public propertyCurrentMode Current select mode
Public propertyHandle Returns IntPtr of the current sheet.
Public propertyHighlightedObjects List of highlighted objects
Public propertyIsDirty Content has changed
Public propertyLockSelectionContainer If selection container is locked, the return value is true otherwise false. If true only elements in specified layer can be selected.
Public propertyMaps List all maps in this Sheet.
Public propertyReadOnly The user can modifies the map.
Public propertyRoot Root element of this sheet.
Public propertySelectable The user can select object by click.
Public propertySelectedObjects List of selected objects.
Public propertySelectionContainer Get or set the current layer for selecting elements. Use property LockSelectionContainer if only elements in specified layer are selectable.
Public propertyShowLineal Show the lineal
Public propertyShowProperties The user can open property dialogs for specific objects.
Public propertyShowWorkspace Should the Workspace (background behind the paper area) be drawn.
Public propertyUseDisplayScale Specifies if the scale of Maps is calculated according to the physical size of the Sheet or the current display of the Sheet
Public propertyWindow The window element of this sheet.
Top
Methods
 NameDescription
Public methodDisposeReleases all resources used by the Sheet
(Overrides Wrapper.Dispose)
Public methodDraw Draw to a GDI-Plus graphics context
Public methodRedraw Force a redraw
Public methodSetDefaultMode Activate pick mode
Public methodSetDirty Force a redraw
Public methodSetMeasureMode Activate measure mode
Public methodSetPanMode Activate pan mode
Public methodSetSelectPolygonMode Activate polygon mode
Public methodSetSelectRadiusMode Activate radius mode
Public methodSetSelectRectangleMode Activate rectangle mode
Public methodSetZoomMode Activate zoom mode
Public methodZoom100 Zoom map to 100 percent.
Public methodZoomAll Zoom to full extend
Public methodZoomIn Zoom in
Public methodZoomLast Zoom to last zoom position
Public methodZoomOut Zoom out
Public methodZoomSelection Bring all selected objects into view
Public methodZoomToLayerElements(MapLayer, IEnumerableObject) Zoom the view to specified area
Public methodZoomToLayerElements(MapLayer, String) Zoom the view to specified area
Public methodZoomToRectangle Zoom to specified rectangle
Top
Events
 NameDescription
Public eventAfterPan The view position has been changed
Public eventAfterSelectionContainerChanged Fired after the selection container changed
Public eventAfterZoom The viewport has been changed
Public eventBeforeSelectionContainerChanged Fired before the selection container changed
Public eventPaint The Sheet has been redrawn
Public eventSelectionChanged Selection has been changed
Public eventSheetStatusChanged Fired when the status of a sheet changed
Public eventViewChanged View has been changed
Top
Remarks
A Sheet is a host for visual elements and provides infrastructure for drawing and mouse handling. All visual elements implement WindowlessComponent and can contain child elements. The Root Property contains the Paper element which is the main container with a metric coordinate system. The SelectedObjectCollection maintains a list of selected objects and can only contain elements within the same container (SelectionContainer).
Note  Note
The Maps property contains a list of all Map elements in the sheet.
Example
Sample shows, how to get the area id of userdefined selected areas in the current sheet using the EasyMapControl.
C#
public partial class Form1 : Form
{
    public Form1()
    {
       InitializeComponent();

       //Add EventHandler
       emControl.Events.DocumentChanged += new Easymap._IECtlEvents_DocumentChangedEventHandler(Events_DocumentChanged);

       //Begin loading the workbook
       emControl.BeginLoadFromFile("Path of workbook");
    }

   //DocumentChanged Event, gets fired when document loaded
   private void Events_DocumentChanged(object sender, EventArgs e)
   {
        if (emControl.Document != null)
        {
            var layerForSelectionContainer = emControl.Document.CurrentSheet.Items.FindByCaption("Postalcode - Areas");
            if (layerForSelectionContainer != null)
            {
                //Set the specified layer for selecting elements.
                emControl.Document.CurrentSheet.SelectionContainer = (Easymap.IWindowlessComponent)layerForSelectionContainer;

                //Lock the selection container. Only elements in this layer can be selected.
                emControl.Document.CurrentSheet.LockSelectionContainer = true;
            }

            //Add SelectionChangedEventHandler, to act when the user select elements in EasyMapControl
            emControl.Document.CurrentSheet.SelectionChanged += new Easymap.SheetEvents_SelectionChangedEventHandler(CurrentSheet_SelectionChanged);
        }
    }

    //Occures when SelectionChangedEventHandler was fired
    private void CurrentSheet_SelectionChanged(object sender, EventArgs args)
    {
        //Do something if Count > 0
        if (emControl.Document.CurrentSheet.SelectedObjects.Count == 0)
            return;

        //Foreach IWindowlessComponent in the collection must be casted to LayerElementComponent to get the area id.
        for (int i = 0; i < emControl.Document.CurrentSheet.SelectedObjects.Count; i++)
        {
            Easymap.IWindowlessComponent obj = emControl.Document.CurrentSheet.SelectedObjects.get_Item(i);

            if (obj is Easymap.LayerElementComponent)
            {
                var layerElementComponent = (Easymap.LayerElementComponent)obj;
                string areaID = layerElementComponent.LayerElement.Key;
            }
        }

    }
}
See Also