This example demonstrates how to highlight shapes when mouse cursor is over them and to show the attribute values in the status bar.
using System.Windows.Forms;
using AxMapWinGIS;
using MapWinGIS;
namespace Examples
{
public partial class MapExamples
{
private ToolStripStatusLabel m_label = null;
public void ShowAttributes(
AxMap axMap1,
string dataPath, ToolStripStatusLabel label)
{
string filename = dataPath + "landuse.shp";
{
m_layerHandle = axMap1.
AddLayer(sf,
true);
m_label = label;
}
else
{
MessageBox.Show("Failed to open shapefile");
}
}
void AxMap1ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e)
{
if (sf != null)
{
string s = "";
{
if (val == "") val = "null";
s += sf.
Table.Field[i].Name +
":" + val +
"; ";
}
m_label.Text = s;
}
}
}
}
tkCursorMode
Available cursor modes. Determines the default respond of map to the action of user.
Definition: Enumerations.cs:344
tkMapProjection
Commonly used map projections to be set in Form Designer (see AxMap.Projection property).
Definition: Enumerations.cs:1741
Map component for visualization of vector, raster or grid data.
Definition: AxMap.cs:56
Provides a functionality for accessing and editing ESRI shapefiles.
Definition: Shapefile.cs:72
tkMapProjection Projection
Sets projection of the map. It providers 2 most commonly used coordinate system/projections to be eas...
Definition: AxMap.cs:2709
_DMapEvents_ShapeHighlightedEventHandler ShapeHighlighted
This event is fired when mouse cursor is being moved by user and the cursor enters or leaves neighbor...
Definition: AxMap.cs:3303
tkCursorMode CursorMode
Gets or sets the cursor mode for the map.
Definition: AxMap.cs:456
bool SendMouseMove
Gets or sets whether the map sends mouse move events.
Definition: AxMap.cs:562
int AddLayer(object Object, bool visible)
Adds a layer to the map.
Definition: AxMap.cs:1342
Shapefile get_Shapefile(int layerHandle)
Gets shapefile object associated with the layer.
Definition: AxMap.cs:1546
bool Open(string shapefileName, ICallback cBack)
Opens shapefile from the disk.
Definition: Shapefile.cs:1430
Table Table
Gets the reference to the attribute table associated with the shapefile.
Definition: Shapefile.cs:677
int NumFields
Gets the number of fields in attribute table of the shapefile.
Definition: Shapefile.cs:672
object get_CellValue(int fieldIndex, int shapeIndex)
Gets the value of the specified field for the shape.
Definition: Shapefile.cs:601