Doing DotSpatial in Microsoft Visual C# 2010 Express: New Items in Toolbox of DotSpatial Map

Jan 31, 2011 at 7:48 PM
Edited Feb 8, 2011 at 3:00 PM

Hi all,

With nice help from Mr. Matthew Klein, I created my first DotSpatial project in Microsoft Visual C# 2010 Express suscessfully.  I got the "Legend" and "Map Layers" part done.  But I do not know how to get the "Toolbox" part created.  Please kindly help and advise me how the Items of the "Toolbox" part can be created for doing the Section 1.3 Simplify Australia Data Layers and Section 1.4 Programmatic Point Symbology presented in the MapWindow GIS Developer's Corner, written by Harod (Ted) Dunsford, Jr., Mark Van Orden and Jiri Kadler, October 2009.

Thanks in advance,

Scott Chang, Ph. D.

Jan 31, 2011 at 11:15 PM

You will find a control called "Tool Manager" that needs to be placed on your form.

Also, you need an AppManager component. Set the Map property and ToolManager property of the AppManager to the corresponding controls.

Feb 1, 2011 at 4:53 AM

actually, technically i don't think you need an app manager for the tool manager to work.  it was written separately by brian, so has a stand alone dynamic link system built into the tool manager.  however an important thing you will have to do is ensure the dll with itool implementations is added to the "tools" directory.

Feb 1, 2011 at 4:56 AM

also check for a map or legend property on the tool manager and set it accordingly if you find it.  i think this is how you let the tool dialogs know what layers are available for data input dropdowns.

Feb 1, 2011 at 10:17 PM

You will find a control called "Tool Manager" that needs to be placed on your form.

Set the legend property of this control to the legend control you are using.

Also, you need to copy the tools folder to the output directory of your sample project.

Here's a short video that may help.

Feb 3, 2011 at 8:11 PM

Hi mudnug and Ted,  Thank you both very much.

I will follow the procedures of your short video to get the Items of the ToolBox in my DotSpatial projects, mudnug.

Thanks again,

Scott Chang 

Feb 7, 2011 at 12:54 PM
Edited Feb 8, 2011 at 2:42 PM

Hi mudnug,  I need your help.

I copied DotSpatial.Tools.dll, DotSpatial.Tools.pdb, and DotSpatial.Tools.xml of the Tools folder to the output directory of my project "scDotSpatial_Legend-Toolbox" under the Solution of my project.   I completed all the Steps you instructed in your short video.  I executed my project "scDotSpatial_Legend-Toolbox" in my Visual C# 2010 Express and I got an fatal error:

FileLoadException was unhandled by user code - Could not load file or assembly 'file://C:\Document and Settings\e1enxshc\my documents\visual studio 2010\ProjectscDotSpatial_Legend-Toolbox\scDotSpatial_Legend-Toolbox\bin\Debug\Tools\DotSpatial.Tools.dll or one of its dependencies.  Operation is not supported (Exception from HRESULT: (0x80131515).

This error is pointing to the following code:  

Application.Run(new Form1());  in the Program.cs

I do not know what causes this error and how to resolve it.    Please help and advise how I can resolve this problem.

Thanks in advance,

Scott Chang

P. S.  I need to tell you the following things: (1) I am an enduser, not the Computer Administrator in using Visual C# 2010 Express that is installed in our Microsoft NT 4 LAN System by our Computer Team who used their computer account to install my Visual Studio 2010 Express (Visual C# 2010 Express included) in our LAN System.  Is this the source of problem?  (2) When the Visual Studio 2010 Express/Visual C# 2010 Express were installed, I just have "Window Authentication" chosed.  Do I need the "Remote Authenticaion" option to do this DotSpatial programming? (3) In the error message, I saw "...\Debug\To\ols\DotSpatial.Tools.dll" .... Should I do something in ols or assembly? 


Feb 7, 2011 at 5:16 PM

I don't know that your LAN setup is causing any problems. I expect you would be able to get the project going using your current setup.

you will notice in the video that I copy the files into the project and set the properties on DotSpatial.Tools.dll

Copy to Output Directory 

Copy if newer

Does this help?

Feb 7, 2011 at 6:51 PM
Edited Feb 7, 2011 at 7:09 PM

Hi mudnug,   

I had set the properties on DotSpatial.Tools.dll

Copy to Output Directory 

Copy if newer
I got the error I presented in my last post - i. e. that does not help at all!!!???
DotSpatial experts/mudnug, any more thoughts to solve my error? Please help and advise.
Scott Chang 
P.S. mudnug, I saw a folder "zh-CN" in the "Tools" folder under the Solution in your short video. 
     What is it? Is it something associated with DotSpatial.Tools.dll? Please clarify this "zh-CN" folder for me. 
Feb 7, 2011 at 7:04 PM

Perhaps the suggestions here will help you.

Feb 8, 2011 at 2:54 PM

Hi mudnug,   The suggestions are above my head and do not help me much.  I do not know the "assembly" thing at all.  What can go wrong in the "assembly" of my project and causes the Items of the Toolbox not shown up?  Please help me more on what I should check in the assembly of my project.  Please reply.  Thanks,  Scott Chang  

Feb 15, 2011 at 2:13 AM
Edited Feb 15, 2011 at 2:14 AM

Sorry double post

Feb 15, 2011 at 2:13 AM

Hi Scott,


I was facing the exact same issue under windows 7.

Go to the >bin>Debug>Tools directory of your project. You should find the file DotSpatial.Tools.dll that was copied during the build. Right click on it and select properties. Stay on general Tab and click Unblock on the bottom of the window > Apply > OK and try again.