Layer control – Pitney Bowes MapXtreme User Manual

Page 133

Advertising
background image

Chapter 7: Desktop Applications, Controls, Dialogs, and Tools

Key Controls to Use in Desktop Applications

MapXtreme v7.1

133

Developer Guide

7. In the form's constructor, after the InitializeComponent call, add code to add a custom bitmap to

the MapToolBar's ImageList. How the custom bitmap is associated with the application is up to
the programmer. One option is to add an ImageList to the form at design-time, populate it with
the custom images, then write code to transfer its images to the toolbar's ImageList at runtime.
That code would look like this:

// Add custom tool button's bitmap to toolbar's image list

foreach (Image image in this.imageList1.Images) {

this.mapToolBar1.ImageList.Images.Add(image);

}

// Associate the bitmap with the custom tool's button (last image

in the list)

this.mapToolBarButtonBlueSelect.ImageIndex =

this.mapToolBar1.ImageList.Images.Count-1;

Layer Control

The Layer Control dialog box shows all the layers that make up the current map and the status of the
layers’ attributes. These attributes are: visible, editable, selectable, and auto label. The icons above
each check box column represent the attributes types. ToolTips display over the attribute icons when
you move your cursor over them to help familiarize yourself with each icon. It is easy to change a
layer’s, or multiple layers’ attributes using the check boxes.

The Layer Control also has options available to change the Display and Label settings; modify any
thematic maps you have created, and reorder, add, or remove layers.

You can rearrange layers in the LayerControl by dragging and dropping them in the Layer Control
Layers list.

L

Dropping a layer onto a Label Layer adds a new set of labels to the Label Layer. This can
happen by accident—for example, if you were attempting to move a layer to the spot just
above the Label Layer.

Tip: If you want the dropped layer to be placed outside of the Label Layer, hold down the
Shift key before you drop the layer. As you press and release the Shift key, the cursor
changes to indicate whether the dropped layer will go above or inside the target layer onto
which you are dropping.

The Layer Control puts all the functionality of the Layer Control dialog box onto a form. A single line
of code is necessary in the Form_Load() method to link the Layer Control to the MapControl’s map.

layerControl1.Map = mapControl1.Map;

To better understand the complexities and capabilities of the Layer Control, run the MapXtreme
utility called Workspace Manager. This tool includes a working example of Layer Control. See

Chapter 23 Workspace Manager

. Workspace Manager is available from the Program Menu under

MapInfo\MapXtreme\7.x.x.

Advertising