Could you please give an example on ShapeEidtor.dll?

May 9, 2012 at 11:27 AM

Could anyone give an example on how to use the ShapeEidtor plugin of dotspatial? I've searched and tried, but failed to use it. How to add the shape editor as a toolbar? How to edit the editor tool? Please give me some example code? Thanks a lot!

May 9, 2012 at 7:57 PM

If you are talking about ShapeEditor...

See and

How to Load DotSpatial Extensions Into My Toolbar

Jul 25, 2012 at 7:21 PM


I, too, am unclear as to ow to add the ShapeEditor toolbar.  I am using Visual Basic.

I have added a reference to the DLL.  I have "Imports DotSpatial.Plugins.ShapeEditor" at the start of my form.

The documentation that you linked to does not help me understand what to do, as I do not know where to begin.

I have successfully loaded the Measure tool, so loading plugins is not the problem, I don't think.


Sep 2, 2012 at 8:06 PM


Again, I truly would appreciate some guidance about using this extension.  As it stands, my project is currently stalled.

Thank you!

Sep 4, 2012 at 3:11 PM

You won't have to add a reference to an extension to use it. Just drop the dll in your plugins folder. See

Jul 16, 2013 at 12:34 AM
I have the same question.... i manage to install this but that was because i had a clear example..... :o(

SO who has some code which allow to ez-install the shape-editor....

Measure tool
Jul 16, 2013 at 1:13 AM
This code below gives an error

Unable to cast object of type 'DotSpatial.Plugins.ShapeEditor.ShapeEditorPlugin' to type 'DotSpatial.Controls.IMapFunction'.

System.InvalidCastException was unhandled
Message=Unable to cast object of type 'DotSpatial.Plugins.ShapeEditor.ShapeEditorPlugin' to type 'DotSpatial.Controls.IMapFunction'.
Source=SWING viewer
   at SWINGviewer.Form1.ToolStripButtonShapeEditor_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at SWINGviewer.My.MyApplication.Main(String[] Args)
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
    Private WithEvents se As ShapeEditorPlugin
    Private Sub ToolStripButtonShapeEditor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonShapeEditor.Click
        With myVenster
            .FunctionMode = FunctionMode.None
            'if was already added, remove and add again 
            For Each mapfunc As IMapFunction In .MapFunctions
                If TypeOf mapfunc Is ShapeEditorPlugin Then
                    Exit For
                End If
            se = New ShapeEditorPlugin()
            .Cursor = Cursors.Cross
        End With
    End Sub
Jul 17, 2013 at 3:35 PM
Anyone? who has some code examples of how to add the plugin, some commands to add polygons and such...