Sheet Class |
The Sheet type exposes the following members.
| Name | Description | |
|---|---|---|
| ClientBounds | The Bounds of the map control | |
| CurrentMode | Current select mode | |
| Handle | Returns IntPtr of the current sheet. | |
| HighlightedObjects | List of highlighted objects | |
| IsDirty | Content has changed | |
| LockSelectionContainer | If selection container is locked, the return value is true otherwise false. If true only elements in specified layer can be selected. | |
| Maps | List all maps in this Sheet. | |
| ReadOnly | The user can modifies the map. | |
| Root | Root element of this sheet. | |
| Selectable | The user can select object by click. | |
| SelectedObjects | List of selected objects. | |
| SelectionContainer | Get or set the current layer for selecting elements. Use property LockSelectionContainer if only elements in specified layer are selectable. | |
| ShowLineal | Show the lineal | |
| ShowProperties | The user can open property dialogs for specific objects. | |
| ShowWorkspace | Should the Workspace (background behind the paper area) be drawn. | |
| UseDisplayScale | Specifies if the scale of Maps is calculated according to the physical size of the Sheet or the current display of the Sheet | |
| Window | The window element of this sheet. |
| Name | Description | |
|---|---|---|
| Dispose | Releases all resources used by the Sheet (Overrides Wrapper.Dispose) | |
| Draw | Draw to a GDI-Plus graphics context | |
| Redraw | Force a redraw | |
| SetDefaultMode | Activate pick mode | |
| SetDirty | Force a redraw | |
| SetMeasureMode | Activate measure mode | |
| SetPanMode | Activate pan mode | |
| SetSelectPolygonMode | Activate polygon mode | |
| SetSelectRadiusMode | Activate radius mode | |
| SetSelectRectangleMode | Activate rectangle mode | |
| SetZoomMode | Activate zoom mode | |
| Zoom100 | Zoom map to 100 percent. | |
| ZoomAll | Zoom to full extend | |
| ZoomIn | Zoom in | |
| ZoomLast | Zoom to last zoom position | |
| ZoomOut | Zoom out | |
| ZoomSelection | Bring all selected objects into view | |
| ZoomToLayerElements(MapLayer, IEnumerableObject) | Zoom the view to specified area | |
| ZoomToLayerElements(MapLayer, String) | Zoom the view to specified area | |
| ZoomToRectangle | Zoom to specified rectangle |
| Name | Description | |
|---|---|---|
| AfterPan | The view position has been changed | |
| AfterSelectionContainerChanged | Fired after the selection container changed | |
| AfterZoom | The viewport has been changed | |
| BeforeSelectionContainerChanged | Fired before the selection container changed | |
| Paint | The Sheet has been redrawn | |
| SelectionChanged | Selection has been changed | |
| SheetStatusChanged | Fired when the status of a sheet changed | |
| ViewChanged | View has been changed |
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; } } } }