This project is read-only.

Print Layout Dialog


The print layout is a dialog that can be launched from your program in order to allow a developer to assemble the map content, legend content and other features like a scale bar, a north arrow, title text or external images. This is designed inline with the vector drawing system, so that when you print from the Layout control your vectors will be drawn in a vector format, rather than as an image with a fixed pixel resolution. This does not use any kind of internal pdf support, but rather relies on the print drivers inherit in the system.

Adding the Print Layout
The print layout must be launched programmticaly. This requires adding a reference to DotSpatial.Controls.dll, but this should already be the case if you have a map to appear in your print layout. This usually makes the most sense in response to a menu item choice. It can be created for a short term process, or stored as a class level variable so that the same dialog can be called repeatedly. The variable declaration should look like:

_layout = new LayoutForm {MapControl = map1};

Assigning the Map control is very important. Without a Map, the LayoutForm won't be able to show the correct content. Then you can launch the dialog with


This should be familiar as it is the same general behavior for the OpenFileDialog and other dialogs that are used as part of the .Net framework. The "this" in the ShowDialog allows the correct window to be displayed when your dialog closes. This is not required, but usually leads to better behavior for someone that keeps lots of windows open at once.

Frequently Asked Questions
  • I tried to drag a legend onto the display without adding a map and it crashed.
    • This is a bug I just noticed.
  • The legend shows my layers with hundreds of categories collapsed in the treeview. Why is it expanded in the Print Layout.
    • This is a ... 'feature'. This fix has been added as a feature request, but is lower priority than our other bugs for now.
  • Who created this dialog?
    • Brian Marchionni is the master mind behind the print dialog, the toolbox, and the model builder.

Last edited Nov 8, 2010 at 4:22 AM by Shade1974, version 2