alex_bn_lee

导航

【024】◀▶ ArcObjects 类库(一)

ArcObjects 类库(一)

---------------------------------------------------------------------------------------------------------

●·● 目录:

O0 ………… 在线帮助 & 本地帮助
  OMD(对象模型图)


Geodatabase 命名空间

A1 ………… IWorkspaceFactory 接口
A2 ………… IWorkspace 接口
       IFeatureWorkspace 接口
       IWorkspaceEdit 接口
A3 ………… IFeatureClass 接口
A4 ………… IFeatureCursor 接口
A5 ………… IFeature 接口
A6 ………… IField 接口
                   IFieldEdit 接口
A7 ………… IFields 接口
                   IFieldsEdit 接口
A8 ………… IQueryFilter 接口
A9 ………… IGeoDataset 接口
Aa ………… IDataset 接口


Carto 命名空间

G1 ………… ILayer 接口
G2 ………… IFeatureLayer 接口
        IFeatureSelection 接口 
        ISelectionSet 接口 
        IEnumIDs 接口 
G3 ………… IMap 接口
G4 ………… IMapDocument 接口
G5 ………… IGraphicsContainer 接口
G6 ………… IActiveView 接口
G7 ………… IFillShapeElement 接口
G8 ………… IElement 接口
G9 ………… IFrameProperties 接口
Ga ………… IMapFrame 接口
Gb ………… IMapGrid 接口
Gc ………… IMapGrids 接口
Gd ………… ISelectionEnvironment 接口
Ge ………… IPage 接口
Gf  ………… ISnapGrid 接口
Gg ………… ISnapGuides 接口
Gh ………… IRulerSettings 接口
Gi  ………… IGraphicsContainer 接口
Gj  ………… IActiveView 接口
Gk ………… IFillShapeElement 接口
Gl  ………… IElement 接口
Gm………… IElement 接口
Gn ………… IElement 接口


Controls 命名空间

U1 ………… LicenseControl 控件
U2 ………… MapControl 控件
U3 ………… IMapControl2 接口
U4 ………… IMapControl3 接口
U5 ………… IMapControlEvents2 接口
U6 ………… PageLayoutControl 控件
U7 ………… IPageLayoutControl 接口
U8 ………… IPageLayoutControlEvents 控件
U9 ………… ToolbarControl 控件
Ua ………… IToolbarControl2 接口
Ub ………… TOCControl 控件
Uc ………… ITOCControl 接口
                   ILegendGroup 接口
                   ILegendClass 接口
Ud ………… ITOCControlEvents 接口
Ue ………… IHookHelper 接口
Uf  ………… SymbologyControl 控件
Ug ………… ISymbologyControl 接口
                   ISymbologyStyleClass 接口
Uh ………… ISymbologyControlEvents 接口
Ui  ………… TOCControl 控件
Uj  ………… ITOCControl 接口
Uk ………… ITOCControlEvents 接口
Ul  ………… GlobeControl 接口
Um………… GlobeControl 接口

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第O0个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● 在线帮助 & 本地帮助

1. 通过在线帮助和本地帮助可以得到相同的内容,但是本地帮助速度更快,但是在线帮组效果更好,下面的图示展示了如何将二者联系起来,因为二者的排版还是存在一定的差别的!

---------------------------------------------------------------------------------------------------------

●·● OMD(对象模型图)

1> AbstractClass:抽象类算一个超类,不能用来实例化一个对象,比如Line就是一个抽象类,其他的线是Line之上,Line给出了所有线的共同特性和方法。

  符号:平面矩形,白色。

2> CoClass:这种类可以直接通过new方法实例化出一个对象。

  符号:长方体,灰色。

3> Class:这种类不能直接new出一个对象,但是可以通过实例的属性得到或者通过某个方法生成一个对象。

  符号:长方体,白色。

4> Association(关联):表示一个类的实例可以和几个其他类的实例相关联,比如一个Line Symbol对象只能和一个线对象相关。

  符号:灰色的线。

5> Type Inheritance(继承):是一个类可以通过继承,得到其父类的属性和方法,比如Line这个超类之上可以有其他类型的特定线类。

  符号:空心三角箭头。

6> Instantiation(实例化):是某个类的某个方法可以实例化其他类的实例,比如:IWorkspaceFactory类的OpenFromFile()方法可以实例化一个IFeatureWorkspace类的实例。

  符号:虚线箭头。

7> Composition(组成):是一个强制的关系,是一个类的实例包含了其他的类的实例,比如一个points会包含很多个point,当这么多的point的生命周期没有结束,points对象就不能从内存中卸载掉。

  符号:黑色菱形。

8> Inbounde Interface(入接口):封装了若干属性和方法。

  符号:空心圆。

9> Outbound Interface(出接口):封装的事件,即对象支持哪些事件的触发。

  符号:实心圆。

※ 参考:CoClass 和 Class 的区别1

※ 参考:CoClass 和 Class 的区别2

※ 参考:ArcObjects学习的重要工具 Object Model Diagrams

※ 参考:关于接口的理解

※ 参考:Arcgis Engine -- 接口编程思想

View Code
        interface Iperson //接口
{
void xuexi();
}
interface Idustman : Iperson
{
void saodi();
}
interface Iprogramer : Idustman
{
void biancheng();
}
interface Imanager : Iprogramer
{
void guanji();
}

class Test : Imanager
{
public void xuexi()
{

}
public void saodi()
{

}
public void biancheng()
{

}
public void guanji()
{

}
}

class person //
{
public void xuexi1()
{

}
}
class dustman : person
{
public void soadi1()
{

}
}
class programer : dustman
{
public void biancheng1()
{

}
}
class manager : programer
{
public void guanji1()
{

}
}

class Test2 : manager
{

}

private void Form1_Load(object sender, EventArgs e)
{
Iperson Person = new Test();
Person.xuexi();
Idustman Dustman = Person as Idustman;
Dustman.saodi();
Dustman.xuexi();
Iprogramer Programer = Dustman as Iprogramer;
Programer.biancheng();
Programer.xuexi();
Programer.saodi();
Imanager Manager = Programer as Imanager;
Manager.guanji();
Manager.biancheng();
Manager.xuexi();
Manager.saodi();

person p = new person();
p.xuexi1();
dustman d = p as dustman;
d.soadi1();
d.xuexi1();
programer pro = d as programer;
pro.soadi1();
pro.xuexi1();
pro.biancheng1();
manager m = pro as manager;
m.soadi1();
m.xuexi1();
m.biancheng1();
m.guanji1();
}

  接口只需提供方法,但是不用提供解决的途径,解决的途径在相应的类中定义,一个类可以同时集成多个接口,这些接口可以没有任何关系,但是类只能继承一个类,这里就体现出接口的优势,不同的接口可以将类的方法有机的分离开,更好的实现管理!(@McDelfino拙见)

参考:

其中,Nest和Chicken 是聚合关系(Aggregation),既它们之间不共存。
          Wings和Chicken是组合关系(Composition),它们共存,翅膀是鸡的一部分,鸡不在了翅膀也就没了。
     Bird和Chicken是继承关系(Type Inheritance),鸡是鸟的一种。
     Egg和Chicken是实例化关系(Instantiation),鸡蛋可以用鸡的方法来实例化,鸡下蛋实例化鸡蛋。
     Bird是AbstractClass,不能实例化。
     Chicken和Nest是CoClass,可以通过New关键字来实例化。
     Egg和Wings是Class,可以通过其他实例的方法来实例化。

---------------------------------------------------------------------------------------------------------

●·● Geodatabase 命名空间

1. 该类库提供了统一的接口来访问空间数据,使用频率非常高的接口 IFeatureClass、ITable、IQueryFilter 等接口都是位于该类库中。用户在打开要素类、打开表、查询数据、读取数据、更新数据时都需要引用此类库。下图描述了表格、要素类、字段等对象之间的关系。

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A1个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IWorkspaceFactory 接口

1. Use IWorkspaceFactory when you need to create a new workspace, connect to an existing workspace or find information about a workspace.

2. 属性和方法:

 属性和方法Description
Method ContainsWorkspace Indicates if parentDirectory contains a valid workspace, or is a valid file-system workspace.
Method Copy Copies a workspace to the specified destination folder.
Method Create Creates a new workspace specified by the directory, file name, and connection properties.
Method GetClassID The class ID of the WorkspaceFactory.
Method GetWorkspaceName Retrieves the workspace name of a workspace from the given list of file names.
Method IsWorkspace True if the specified file identifies a workspace supported by the workspace factory.
Method Move Moves a workspace to the specified destination folder.
Method Open Opens the workspace specified by the connection properties.
Method OpenFromFile
(string fileName, int hWnd)
返回值:IWorkspace
Opens the workspace specified by the given file name.
参考:http://www.gisvip.com/blog/?action-viewthread-tid-2400
Method ReadConnectionPropertiesFromFile The connection properties from the specified file.
Read-only property WorkspaceDescription A singular or plural description of the type of workspace the workspace factory opens/creates.
Read-only property WorkspaceType The type of workspace the workspace factory opens/creates.

参考:http://www.3sfield.com/content.php?id=327

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A2个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IWorkspace 接口

1. Provides access to members that have information about the workspace.

  工作空间!

2. 属性和方法:

  方法和属性Description
Read-only property ConnectionProperties The connection properties of the workspace.
Read-only property DatasetNames The DatasetNames in the workspace.
Read-only property Datasets The datasets in the workspace.
Method ExecuteSQL Executes the specified SQL statement.
Method Exists Checks if the workspace exists.
Method IsDirectory TRUE if the workspace is a file system directory.
Read-only property PathName The file system full path of the workspace.
Read-only property Type The Type of the Workspace.
Read-only property WorkspaceFactory The factory that created the workspace.

---------------------------------------------------------------------------------------------------------

●·● IFeatureWorkspace 接口

1. Provides access to members that create and open various types of datasets and other workspace level objects.

 

  Members

 

  Description
Method CreateFeatureClass
(string Name, IFields Fields, UID CLSID, UID EXTCLSID, esriFeatureType FeatureType, string ShapeFieldName, string ConfigKeyword)
返回值:IFeatureClass
Creates a new standalone feature class under the workspace.
第一个参数:shp文件名
第二个参数:添加的 Fields
第三个参数:null
第四个参数:null
第五个参数:要素类型
第六个参数:图形列的名称
第七个参数:""
Method CreateFeatureDataset Creates a new feature dataset.
Method CreateQueryDef Create a query definition object.
Method CreateRelationshipClass Creates a new relationship class.
Method CreateTable Creates a new table.
Method OpenFeatureClass
(string Name)
返回值:IFeatureClass
Opens an existing feature class.
返回指定文件名的 FeatureClass。
Method OpenFeatureDataset Opens an existing feature dataset.
Method OpenFeatureQuery Opens a feature dataset containing a single feature class defined by the specified Query.
Method OpenRelationshipClass Opens an existing relationship class.
Method OpenRelationshipQuery The table of a relationship join query.
Method OpenTable Opens an existing table.

---------------------------------------------------------------------------------------------------------

●·● IWorkspaceEdit 接口

1. Provides access to members that control Workspace Editing. Note: the IWorkspaceEdit interface has been superseded byIWorkspaceEdit2. Please consider using the more recent version.

 

  Members

 

  Description
Method AbortEditOperation Aborts an edit operation.
Method DisableUndoRedo Disables Undo and Redo of edit operations.
Method EnableUndoRedo Enables Undo and Redo of edit operations.
Method HasEdits True if there are any completed edit operations that need to be saved .
Method HasRedos True if there are any completed undos that can be redone.
Method HasUndos True if there are any completed edit operations that can be undone.
Method IsBeingEdited True if the workspace is being edited.
Method RedoEditOperation Causes a Redo to be performed on the last undo.
Method StartEditing Starts editing the workspace.
Method StartEditOperation Begins an edit operation.
Method StopEditing Stops editing the workspace.
Method StopEditOperation Ends an edit operation.
Method UndoEditOperation Causes an Undo to be performed on the last edit operation.

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A3个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IFeatureClass 接口

1. The IFeatureClass interface is the main interface for getting and setting properties of a feature class. For example, use the IFeatureClass interface to get the type of feature class, get a count of features that satisfy some query, or create a new feature in the feature class. The IFeatureClass interface inherits from the IObjectClass interface.

  获取或设置要素的属性,要素类!

2. 属性和方法:

  方法和属性Description
Method AddField Adds a field to this object class.
Method AddIndex Adds an index to this object class.
Read-only property AliasName The alias name of the object class.
Read-only property AreaField The geometry area field.
Read-only property CLSID The GUID for the COM Class (CoClass) corresponding to instances of this object class.
Method CreateFeature
返回值:IFeature
Create a new feature, with a system assigned object ID and null property values.
Method CreateFeatureBuffer Create a feature buffer that can be used with an insert cursor.
Method DeleteField Deletes a field from this object class.
Method DeleteIndex Deletes an index from this object class.
Read-only property EXTCLSID The GUID for the COM Class (CoClass) corresponding to the class extension for this object class.
Read-only property Extension The extension for this object class.
Read-only property ExtensionProperties The extension properties for this object class.
Read-only property FeatureClassID The unique ID for the Feature Class.
Method FeatureCount
(IQueryFilter QueryFilter)
The number of features selected by the specified query.
若是null,则选择全部~
Read-only property FeatureDataset The feature dataset that contains the feature class.
Read-only property FeatureType The type of features in this feature class.
Read-only property Fields The fields collection for this object class.
Method FindField The index of the field with the specified name.
Method GetFeature
(int ID)
Get the feature with the specified object ID.
通过获取 FID 列的值来获取 IFeature!!!
Method GetFeatures Get a cursor of Rows given a set of object ids.
Read-only property HasOID Indicates if the class has an object identity (OID) field.
Read-only property Indexes The indexes collection for this object class.
Method Insert Returns a cursor that can be used to insert new features.
Read-only property LengthField The geometry length field.
Read-only property ObjectClassID The unique ID for the object class.
Read-only property OIDFieldName The name of the field corresponding to the OID.
Read-only property RelationshipClasses The relationship classes in which this object class participates in for the specified role.
Method Search
(IQueryFilter filter, bool Recycling)
Returns an object cursor that can be used to fetch feature objects selected by the specified query.
Method Select Returns a selection That contains the object ids selected by the specified query.
Read-only property ShapeFieldName The name of the default sShape field.
Read-only property ShapeType The type of the default Shape for the features in this feature class.
Method Update Returns a cursor that can be used to update features selected by the specified query.

※ 参考:http://www.3sfield.com/content.php?id=317

提取要素属性:

            ILayer pLayer = axMapControl1.get_Layer(0); //获取图层
IFeatureLayer pFLayer = pLayer as IFeatureLayer; //获取矢量图层
IFeatureClass pFC = pFLayer.FeatureClass; //获取属性列表

IFeatureCursor pFCursor = pFC.Search(null, false); //访问要素
IFeature pFeature = pFCursor.NextFeature(); //获取单个要素

DataTable pTable = new DataTable();
DataColumn colName = new DataColumn("国家名");
colName.DataType = System.Type.GetType("System.String");
pTable.Columns.Add(colName);

DataColumn colArea = new DataColumn("洲名");
colArea.DataType = System.Type.GetType("System.String");
pTable.Columns.Add(colArea);

int indexOfName = pFC.FindField("NAME");
int indexOfName2 = pFC.FindField("REGION");

while (pFeature != null)
{
string name = pFeature.get_Value(indexOfName);
string area = pFeature.get_Value(indexOfName2);
DataRow pRow = pTable.NewRow();
pRow[0] = name;
pRow[1] = area;
pTable.Rows.Add(pRow);
pFeature = pFCursor.NextFeature();
}
dataGridView1.DataSource = pTable;

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A4个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IFeatureCursor 接口

1. Provides access to members that hand out enumerated features, field collections and allows for the updating, deleting and inserting of features.

  用来访问要素类中的一系列要素。

2. 属性和方法:

  方法和属性Description
Method DeleteFeature Delete the existing Feature in the database corresponding to the current position of the cursor.
Read-only property Fields The fields Collection for this cursor.
Method FindField The index of the field with the specified name.
Method Flush Flush any outstanding buffered writes to the database.
Method InsertFeature Insert a new Feature into the database using the property values in the input buffer. The ID of the new Feature is returned.
Method NextFeature Advance the position of the cursor by one and return the Feature object at that position.
Method UpdateFeature Update the existing Feature in the database corresponding to the current position of the cursor.

※ 参考:http://blog.163.com/shuai686868@126/blog/static/203034612010102613814320/

※ 参考:http://www.3sfield.com/content.php?id=319

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A5个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IFeature 接口

1. Provides access to members that return and set properties of a feature.

  相当于每一个单独的要素,点、线或面!

2. 属性和方法:

  方法和属性Description
Read-only property Class The Object Class for the row.
Method Delete Deletes the row.
Read-only property Extent The extent of the feature.
Read-only property FeatureType The type of the feature.
Read-only property Fields The fields Collection for this row buffer.
Read-only property HasOID Indicates if the row has an OID.
Read-only property OID The OID for the row.
Read/write property Shape
返回值:IGeometry
A reference to the default shape for the feature.
Read-only property ShapeCopy
返回值:IGeometry
A cloned copy of the default shape for the feature.
与上面的Shape,在我看来没有什么大的区别,可以获得要素的几何形体,以至于其envelope!
Method Store Stores the row.
Read-only property Table The Table for the row.
Read/write property Value
object get_Value(int Index);
void set_Value(int Index, object Value);
The value of the field with the specified index.
第一个参数:索引  第二个参数:值
获取要素某个字段的值、为要素的某个字段赋值!
通过“IFields.FindField("字段名称")”可以获取索引!

※ 参考:http://www.3sfield.com/content.php?id=315

 

IFeature pFeature = pFeatureClass.CreateFeature();
pFeature.Shape = pPointColl as IPolygon;
pFeature.Store();
pFeature.set_Value(pFeature.Fields.FindField(pColumns[2]), pBuildingList[i].Trim());
pFeature.Store();

 

 

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A6个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IField 接口

1. Provides access to members that return information about the field. Note: the IField interface has been superseded byIField2. Please consider using the more recent version.

  The field object represents a column in a table. A field has many properties, the most obvious ones being its name and its datatype. The esriFieldType enumeration lists the possible datatypes.

  CoClasses that implement IField

CoClasses and ClassesDescription
Field ESRI Field object.

2. 属性和方法:

  Description
Read-only property AliasName The alias name of the field.
Method CheckValue Indicates if the value is valid given the field definition.
Read-only property DefaultValue The default value of the field.
Read-only property Domain The default domain of the field.
Read-only property DomainFixed Indicates if the field's domain is fixed.
Read-only property Editable Indicates if the field is editable.
Read-only property GeometryDef The geometry definition for the field if IsGeometry is TRUE.
Read-only property IsNullable Indicates if the field can contain null values.
Read-only property Length The maximum length, in bytes, for values described by the field.
Read-only property Name The name of the field.
Read-only property Precision The precision for field values.
Read-only property Required Indicates if the field is required.
Read-only property Scale The scale for field values.
Read-only property Type
返回值:esriFieldType
The type of the field.
esriFieldType 枚举:int、long、Geometry、OID等
Read-only property VarType The VARTYPE of the field (e.g. VT_I4).

---------------------------------------------------------------------------------------------------------

 

●·● IFieldEdit 接口

1. Provides access to members that edit the field properties including raster column definition.

 

  Members

 

  Description
Read-only property AliasName The alias name of the field.
Write-only property AliasName The alias name of the field.
Method CheckValue Indicates if the value is valid given the field definition.
Read-only property DefaultValue The default value of the field.
Write-only property DefaultValue The default value of the field.
Read-only property Domain The default domain of the field.
Write-only property Domain The default domain of the field.
Write-only property DomainFixed Indicates if the field's domain cannot be modified.
Read-only property DomainFixed Indicates if the field's domain is fixed.
Write-only property Editable Indicates if the field can be edited. This should always be set to true.
Read-only property Editable Indicates if the field is editable.
Read-only property GeometryDef The geometry definition for the field if IsGeometry is TRUE.
Write-only property GeometryDef The geometry definition if IsGeometry is TRUE.
Write-only property IsNullable Indicates if field values can be null.
Read-only property IsNullable Indicates if the field can contain null values.
Write-only property Length The maximum length, in bytes, for field values.
Read-only property Length The maximum length, in bytes, for values described by the field.
Read-only property Name The name of the field.
Write-only property Name The name of the field.
Read-only property Precision The precision for field values.
Write-only property Precision The precision for field values.
Read/write property RasterDef The raster column definition.
Read-only property Required Indicates if the field is required.
Write-only property Required Indicates if the field is required.
Read-only property Scale The scale for field values.
Write-only property Scale The scale for field values.
Write-only property Type The type for the field.
Read-only property Type The type of the field.
Read-only property VarType The VARTYPE of the field (e.g. VT_I4).

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A7个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IFields 接口

1. Provides access to members that return information about the fields. Note: the IFields interface has been superseded byIFields2. Please consider using the more recent version.

  The Fields object represents a collection of columns in a table. The term field is synonymous with column. Each table in a database has an ordered collection of fields, there is always at least one field in a table. The ordered collection behaves like a list, so it is possible to access individual fields by a numbered position (or index) in the list.

  CoClasses that implement IField

CoClasses and ClassesDescription
Fields ESRI Fields object.

2. 属性和方法:

  Description
Read-only property Field The field at the specified index in the fields collection.
Read-only property FieldCount The number of fields in the fields collection.
Method FindField Finds the index of the named field in the fields collection.
Method FindFieldByAliasName Finds the index of the field with the alias name in the fields collection.

① 将矢量数据的所有字段名称加到 comboBox1 中!

private void loadData()
{
ILayer pLayer = axMapControl1.get_Layer(0); //获取图层
IFeatureLayer pFLayer = pLayer as IFeatureLayer; //转换为矢量图层
IFeatureClass pFClass = pFLayer.FeatureClass; //获取图层表格数据
IFields pFields = pFClass.Fields; //获取字段集合
for (int i = 2; i < pFields.FieldCount;i++ ) //遍历字段
{
comboBox1.Items.Add(pFields.Field[i].Name); //获取每个字段的名称
}
comboBox1.Text = comboBox1.Items[2].ToString(); //设置默认显示
}

② 将矢量数据某个字段的全部 feature 值加入到 comboBox2 中!

private void loadFieldData()
{
comboBox2.Items.Clear(); //删除所有值
ILayer pLayer = axMapControl1.get_Layer(0); //获取图层
IFeatureLayer pFLayer = pLayer as IFeatureLayer; //转换为矢量图层
IFeatureClass pFClass = pFLayer.FeatureClass; //获取图层表格值
IFields pFields = pFClass.Fields; //获取所有字段
int Index = pFClass.FindField(comboBox1.Text); //找到列所在的 Index!

IFeatureCursor pFCursor = pFClass.Search(null, false); //用于循环null就是遍历全部
IFeature pFeature = pFCursor.NextFeature(); //用于获取每一个feature
while (pFeature != null)
{
string name = pFeature.get_Value(Index); //获取 Index 列的值!
comboBox2.Items.Add(name); //添加
pFeature = pFCursor.NextFeature(); //下一个要素
}
comboBox2.Text = comboBox2.Items[0].ToString(); //初始化
}

③ 在地图上选择特定的 feature!

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
axMapControl1.Map.ClearSelection(); //清除地图上的选择
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeography, null, null); //刷新地图

ILayer pLayer = axMapControl1.get_Layer(0); //获取图层
IFeatureLayer pFLayer = pLayer as IFeatureLayer; //获取矢量图层
IFeatureClass pFC = pFLayer.FeatureClass; //获取属性
IQueryFilter pQFilter = new QueryFilter(); //新建查询
pQFilter.WhereClause = comboBox1.Text + "='" + comboBox2.Text + "'"; //查询内容
IFeatureCursor pFCursor = pFC.Search(pQFilter, false); //新建鼠标指针遍历
IFeature pFeature = null; //新建一个要素
pFeature = pFCursor.NextFeature(); //下一个要素
if (pFeature != null) //遍历
{
axMapControl1.Map.SelectFeature(axMapControl1.get_Layer(0), pFeature); //选择要素
axMapControl1.Refresh(esriViewDrawPhase.esriViewGraphicSelection, null, null); //刷新
}
}

---------------------------------------------------------------------------------------------------------

●·● IFieldsEdit 接口

1. Provides access to members that modify a fields collection. 

  Members

  Description
Method AddField Add a field to the fields collection.
Method DeleteAllFields Delete all the fields from the fields collection.
Method DeleteField Delete a field from the fields collection.
Read-only property Field The field at the specified index in the fields collection.
Write-only property Field The field at the specified position.
Read-only property FieldCount The number of fields in the fields collection.
Write-only property FieldCount The Number of fields in this field collection.
Method FindField Finds the index of the named field in the fields collection.
Method FindFieldByAliasName Finds the index of the field with the alias name in the fields collection.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A8个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IQueryFilter 接口

1. Provides access to members that filter data based on attribute values and or relationships.

  IQueryFilter filters data based on an attribute query. A string defining a where clause is required. An optional list of columns may be included to specify the column values to be retrieved. If no columns are specified, all values will be returned.

  CoClasses that implement IQueryFilter

CoClasses and ClassesDescription
ImageQueryFilter (esriCarto) An image query filter.
QueryFilter ESRI Query Filter object.
SpatialFilter ESRI Spatial Filter object.
TemporalQueryFilter (esriTrackingAnalyst) Controls properties for the temporal query filter.
TimeQueryFilter (esriCarto) TimeQueryFilter Class

2. 属性和方法:

  Description
Method AddField Appends a single field name to the list of sub-fields.
Read/write property OutputSpatialReference The spatial reference in which to output geometry for a given field.
Read/write property SubFields The comma delimited list of field names for the filter.
Read/write property WhereClause The where clause for the filter
定义查询的语句。

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第A9个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IGeoDataset 接口

  Members

  Description
Read-only property Extent The extent of the GeoDataset.
相当于 FullExtent 的作用!
Read-only property SpatialReference The spatial reference of the GeoDataset.

IFeatureLayer:对图层缩放显示!

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Aa个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IDataset 接口

1. Provides access to members that supply dataset information.

  Members

  Description
Read/write property BrowseName The browse name of the dataset.
Method CanCopy True if this dataset can be copied.
Method CanDelete True if this dataset can be deleted.
Method CanRename True if this dataset can be renamed.
Read-only property Category The category of the dataset.
Method Copy Copies this dataset to a new dataset with the specified name.
Method Delete Deletes this dataset.
Read-only property FullName The associated name object.
Read-only property Name The name of the Dataset.
Read-only property PropertySet The set of properties for the dataset.
Method Rename Renames this Dataset.
Read-only property Subsets Datasets contained within this dataset.
Read-only property Type The type of the Dataset.
Read-only property Workspace The workspace containing this dataset.

 

---------------------------------------------------------------------------------------------------------

●·● Carto 命名空间

1. Carto 类库中的对象负责创建地图、显示图层。使用频率比较高的 Imap、ILayer、IFeatureRenderer 都在 Carto 类库中,另外还包括地图元素 IElement 接口和子接口,例如:ILineElement、ITextElement 等。

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G1个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ILayer 接口

1. ILayer is a generic 【通用的、一般的】 interface for all layer objects. This interface has a method to draw the layer and provides access to generic layer properties.

  各种图层的一个基类!

2. 属性和方法:

  方法和属性Description
Read-only property AreaOfInterest The default area of interest for the layer.
Read/write property Cached Indicates if the layer needs its own display cache.
Method Draw Draws the layer to the specified display for the given draw phase.
Read/write property MaximumScale Maximum scale (representative fraction) at which the layer will display.
Read/write property MinimumScale Minimum scale (representative fraction) at which the layer will display.
Read/write property Name Layer name.
Read/write property ShowTips Indicates if the layer shows map tips.
Write-only property SpatialReference Spatial reference for the layer.
Read-only property SupportedDrawPhases Supported draw phases.
Read-only property TipText Map tip text at the specified location.
Read-only property Valid Indicates if the layer is currently valid.
Read/write property Visible Indicates if the layer is currently visible.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G2个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IFeatureLayer 接口

1. Provides access to the properties and methods of a layer based on vector geographic data, which is typically a geodatabase, shapefile, or coverage feature class.

  矢量图层,shapefile等!
  FeatureLayer:CoClass。

2. 属性和方法:

  方法和属性Description
Read-only property AreaOfInterest The default area of interest for the layer.
Read/write property Cached Indicates if the layer needs its own display cache.
Read/write property DataSourceType Data source type.
Read/write property DisplayField Primary display field.
Method Draw Draws the layer to the specified display for the given draw phase.
Read/write property FeatureClass The layer's feature class. 获取要素类!
Read/write property MaximumScale Maximum scale (representative fraction) at which the layer will display.
Read/write property MinimumScale Minimum scale (representative fraction) at which the layer will display.
Read/write property Name Layer name. 显示在TOC上的名称。
Read/write property ScaleSymbols Indicates if symbols are scaled for the layer.
Method Search Creates a cursor based upon the search criteria.
Read/write property Selectable Indicates if layer is selectable.
在框选的时候,该层的要素是否可以被选中!
Read/write property ShowTips Indicates if the layer shows map tips.
Write-only property SpatialReference Spatial reference for the layer.
Read-only property SupportedDrawPhases Supported draw phases.
Read-only property TipText Map tip text at the specified location.
Read-only property Valid Indicates if the layer is currently valid.
Read/write property Visible Indicates if the layer is currently visible.
图层的复选框是否被选中!

※ 参考:http://www.3sfield.com/content.php?id=321

插入矢量数据:

OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "shapefile文件(*.shp)|*.shp";
ofd.InitialDirectory = @"F:\Desktop\Temp\ArcGIS_Data";
if (ofd.ShowDialog() != DialogResult.OK)
return;
FileInfo file = new FileInfo(ofd.FileName);

IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory(); //工厂
IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile(file.DirectoryName, 0); //实例化工作空间
IFeatureWorkspace pFeatrueWorkspace = pWorkspace as IFeatureWorkspace; //实例化矢量工作空间

IFeatureClass pFC = pFeatrueWorkspace.OpenFeatureClass(file.Name); //实例化矢量要素类
IFeatureLayer pFLayer = new FeatureLayer(); //实例化矢量图层
pFLayer.FeatureClass = pFC; //建立连接
pFLayer.Name = pFC.AliasName; //命名

IMap pMap = axMapControl1.Map; //实例地图
pMap.AddLayer(pFLayer as ILayer); //增加图层

---------------------------------------------------------------------------------------------------------

 

●·● IFeatureSelection 接口

 

1. Provides access to members that control feature selection.

  获取选择集!

---------------------------------------------------------------------------------------------------------

●·● ISelectionSet 接口

 

1. Provides access to members that manage a set of selected table rows or features. Note: the ISelectionSet interface has been superseded byISelectionSet2. Please consider using the more recent version.

  实例化选择集!

 

---------------------------------------------------------------------------------------------------------

●·● IEnumIDs 接口

 

1. Provides access to members that enumerate through IDs.

  获取选择集中要素的 FID值 集合,依次可以获取选择的要素~

实现:缩放到所有选择要素

IEnvelope layerEnvelope = null;     //实例化一个envelope
IFeatureClass pFeatCls = pLayer.FeatureClass;
IFeatureSelection selectLayer = pLayer as IFeatureSelection;    //QI一个要素选择接口
ISelectionSet selectionSet = selectLayer.SelectionSet;  //获取选择集
IEnumIDs enumIDs = selectionSet.IDs;    //从选择集中获取FID值
IFeature feature;
int i = 1;
int iD = enumIDs.Next();    //读取第一个FID值
while (iD != -1) //-1 is reutned after the last valid ID has been reached        
{
    feature = pFeatCls.GetFeature(iD);  //通过FID值获取要素
    IEnvelope envelope = feature.ShapeCopy.Envelope;    //获取要素的envelope
    if (i == 1)
        layerEnvelope = envelope;   //先给layerEnvelope赋个值,否则后面没法用
    else
    {
        layerEnvelope.Union(envelope);  //其他情况就用union方法
    }
    i++;
    iD = enumIDs.Next();    //遍历到下一个FID值,依次循环
}
pMapControl.Extent = layerEnvelope;
pMapControl.ActiveView.Refresh();

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G3个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMap 接口

1. Use the IMap interface to display data from various data sources.

  The IMap interface is a starting point for many of the tasks one does with a Map. For example, use IMap to add, delete, and access map layers containing data from various sources including feature layers and graphics layers; associate map surround objects (legends, scale bars, etc) with the Map; access the various properties of a Map including the area of interest, the current map units, and the spatial reference; select features and access the Map's current selection.

  相当于一个地图框架。

  Map:CoClass。

2. 属性和方法:

  方法和属性Description
Read/write property ActiveGraphicsLayer The active graphics layer. If no graphic layers exist a basic memory graphics layer will be created.
Method AddLayer Adds a layer to the map.
Method AddLayers Adds multiple layers to the map, arranging them nicely if specified.
Method AddMapSurround Adds a map surround to the map.
Read/write property AnnotationEngine The annotation (label) engine the map will use.
Write-only property AreaOfInterest Area of interest for the map.
Read-only property Barriers The list of barriers and their weight for labeling.
Read-only property BasicGraphicsLayer The basic graphics layer.
Method ClearLayers Removes all layers from the map.
Method ClearMapSurrounds Removes all map surrounds from the map.
Method ClearSelection Clears the map selection.
Read/write property ClipBorder An optional border drawn around ClipGeometry.
Read/write property ClipGeometry A shape that layers in the map are clipped to.
Method ComputeDistance Computes the distance between two points on the map and returns the result.
Method CreateMapSurround Create and initialize a map surround. An optional style from the style gallery may be specified.
Method DelayDrawing Suspends drawing.
Method DelayEvents Used to batch operations together to minimize notifications.
Method DeleteLayer Deletes a layer from the map.
Method DeleteMapSurround Deletes a map surround from the map.
Read/write property Description Description of the map.
Read/write property DistanceUnits The distance units for the map.
Read/write property Expanded Indicates if the Map is expanded.
Read/write property FeatureSelection The feature selection for the map.
Method GetPageSize Gets the page size for the map.
Read/write property IsFramed Indicates if map is drawn in a frame rather than on the whole window.
Read-only property Layer The layer at the given index.
Read-only property LayerCount Number of layers in the map.
Read-only property Layers The layers in the map of the type specified in the uid. If recursive is true it will return layers in group layers.
Read/write property MapScale The scale of the map as a representative fraction.
设置和获取当前地图比例尺的属性。
Read-only property MapSurround The map surround at the given index.
Read-only property MapSurroundCount Number of map surrounds associated with the map.
Read/write property MapUnits The units for the map.
Method MoveLayer Moves a layer to another position.
Read/write property Name Name of the map.
Method RecalcFullExtent Forces the full extent to be recalculated.
Read/write property ReferenceScale The reference scale of the map as a representative fraction.
设置参考比例尺,若为“0”,则取消参考比例尺!
Method SelectByShape
(IGeometry Shape, ISelectionEnvironment env, bool justone)
Selects features in the map given a shape and a selection environment (optional).
axMapControl1.Map.SelectByShape(geometry, null , false);
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null , null);
//esriViewDrawPhase.esriViewGeoSelection刷新选区
Method SelectFeature
(ILayer layer, IFeature feature)
Selects a feature.
给定 图层 和 元素,选择图层中的该要素!

private void SelecteFeatures(List<string> OIDList)
{
    IFeatureClass pFeatureClass = pLayer.FeatureClass;
    string strID = string.Empty;
    string[] IDs = OIDList.ToArray();
    for (int i = 0; i < IDs.Length;i++ )
    {
        strID = IDs[i];
        IFeature selectedFeature = pFeatureClass.GetFeature(Convert.ToInt32(strID));
        pMap.SelectFeature(pLayer, selectedFeature);
    }
    pActiveView.Refresh();
}
Read-only property SelectionCount Number of selected features.
Method SetPageSize Sets the page size for the map (optional).
Read/write property SpatialReference The spatial reference of the map.
Read/write property SpatialReferenceLocked Indicates whether the spatial reference is prevented from being changed.
Read/write property UseSymbolLevels Indicates if the Map draws using symbol levels.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G4个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMapDocument 接口

1. Provides access to members that control the reading and writing of map document files.

   The IMapDocument interface provides properties and methods for reading map document files (*.mxd, *mxt, *.pmf) and writing and saving changes to map document files (*.mxd).  However, since it is not tied to the ArcMap application, application-specific functionality in the MapDocument will not be persisted.  Examples of application specific functionality are toolbar settings, UI customizations, VBA projects, and ArcMap graphs.  For desktop developers who need to use this functionality, the MxDocument interface located in the ArcMapUI library is a better choice.

  相当于一个地图文件,包括多个地图框架,具有“打开”、“保存”和“另存为”的方法。

  MapDocument:CoClass。

  MxDocument:CoClass。

2. 属性和方法:

  属性和方法Description
Read-only property ActiveView The ActiveView of the map document.
Method Close Close the map document.
Read-only property DocumentFilename The map document filename that the MapDocument coclass is linked to.
Read-only property DocumentType The type of map document currently loaded in the object.
Read-only property DocumentVersion Indicates if the version of the map document is compatible with the current version of software.
Method GetVersionInfo Retrieve the detailed version information of the map document.
Read-only property IsMapDocument Indicates if the map document is a valid map document.
Read-only property IsPasswordProtected Indicates if the map document is protected by a passsword.
Read-only property IsPresent Indicates if the map document is present.
Read-only property IsReadOnly Indicates if the map document is read only.
Read-only property IsRestricted Indicates if the use of the map document is restricted to certain applications.
Read-only property Layer The Layer object at the specified index for the specified map.
Read-only property Map
属性:Map [int mapIndex]
方法:get_Map (int mapIndex)
指不同的数据框,每一个数据框相当于一个 Map 。

The Map object at the specified index.
axMapControl1.Map = mapDocument.Map[i];
axMapControl1.Map = mapDocument.get_Map(i);
Read-only property MapCount The number of Map objects contained within the map document.
数据框的个数,也就是 Map 的个数。
Method New Creates and opens a new map document in preparation for the contents to be retrieve or updated.
Method Open
(string sDocument, string bsPassword)
Open the map document in preparation for the contents to be retrieve or updated.
mapDocument.Open(ofd.FileName, "");
Read-only property PageLayout The PageLayout object.
Read-only property Printer The printer object. If no printer object is stored in the map document this returns NULL.
Method ReplaceContents Replace the contents of the map document.
Method Save
(bool bUseRelativePaths, bool bCreateThumnbail)
Save the contents of the map document to the bound file.
mapDocument.Save(true, true);
Method SaveAs
(string sDocument, bool bUseRelativePaths, bool bCreateThumnbail)
Save the contents of the map document to the specified file name.
第一个参数:完整路径,包括名字在内,第二个参数:是否使用相对路径,第三个参数:是否生成缩略图,预览的时候可以显现!
mapDocument.SaveAs(sfd.FileName, false, true);
Method SetActiveView Set the ActiveView content of the map document.
Read-only property Thumbnail The thumbnail stored in the map document. If this is empty E_FAIL is returned.
Read-only property UsesRelativePaths Indicates if the data in the map document is referenced using relative paths.

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G5个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IGraphicsContainer 接口

1. Provides access to members that control the Graphics Container【容器】.

   Objects which manage a collection of graphic elements implement this interface.  For example, the PageLayout, Map, and FDOGraphicsLayer object all implement this interface to provide access to the graphic elements they manage.  

  The PageLayout object contains a collection of Element objects including, MapFrames, MapSurroundFrames, and  GraphicElements such as the PictureElement, MarkerElement and LineElement.  The members of this interface provide access to the Elements.

  When using this interface to add elements to layer types that operate in a corrdinate system, such as FDOGraphicsLayer and CompositeGraphicsLayer, the elements must implement IGraphicElement.

  CoClasses that implement IGraphicsContainer

CoClasses and ClassesDescription
CompositeGraphicsLayer A collection of graphics layers that behave like single layer.
FDOGraphicsLayer A collection of properties for an annotation layer (feature data object graphics layer).
GlobeGraphicsLayer (esriGlobeCore) The Globe Graphics Layer.
GraphicsLayer3D (esri3DAnalyst) A 3D Graphics Layer.
GraphicsSubLayer Graphic sublayer handed back by the composite graphics layer.
Map A container for the display and manipulation of map data.
PageLayout Page Layout class contains maps and map surrounds.

2. 属性和方法:

  Description
Method AddElement
(IElement Element, int zorder)
Add a new graphic element to the layer.
zorder 大部分时候赋值为0.
Method AddElements Add new graphic elements to the layer.
Method BringForward Move the specified elements one step closer to the top of the stack of elements.
Method BringToFront Make the specified elements draw in front of all other elements.
Method DeleteAllElements Delete all the elements.
删除地图上面的所有临时图形元素!
Method DeleteElement
(IElement Element)
Delete the given element.
Method FindFrame
(object frameObject)
Find the frame that contains the specified object.
IFrameProperties frameProperties = (IFrameProperties)axPageLayoutControl1.GraphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap);
Method GetElementOrder Private order object. Used to undo ordering operations.
Method LocateElements Returns the elements at the given coordinate.
Method LocateElementsByEnvelope Returns the elements inside the given envelope.
Method MoveElementFromGroup Move the element from the group to the container.
Method MoveElementToGroup Move the element from the container to the group.
Method Next Returns the next graphic in the container.
Method PutElementOrder Private order object. Used to undo ordering operations.
Method Reset Reset internal cursor so that Next returns the first element.
Method SendBackward Move the specified elements one step closer to the bottom of the stack of elements.
Method SendToBack Make the specified elements draw behind all other elements.
Method UpdateElement The graphic element's properties have changed.

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G6个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IActiveView 接口

1. Provides access to members that control the active view - the main application window.

  This interface manages the main application window in ArcMap and all drawing operations.

  In ArcMap, two objects implement【实现】 this interface: PageLayout and Map.  These two objects correspond to the two different views in ArcMap: layout and data view. Only one view can be active at a time and this is termed the active view. IMxDocument::ActiveView holds a reference to the current active view object (a Map or the PageLayout). For example, if the ArcMap application is in layout mode, IMxDocument::ActiveView returns an IActiveView reference to the PageLayout object.  Alternatively, if the application is in data view, this propery returns a reference【参考】 to the focus map. 

  ArcMap has view commands which allow users to toggle【切换】 between layout view and data view. These commands appear on the View menu and on the scroll bar.

  An ArcMap document can contain many Maps. Make sure you have the desired object when working with this interface. Otherwise, operations such as drawing may not be occurring in the application window as you expect. For example, a Map obtained through IMxDocument::Maps is not guaranteed to be the focus map. If you know you want a reference to the focus map, use IMxDocument::FocusMap.  Similarly, if you know you want a reference to the page layout, use IMxDocument::PageLayout instead. You can change the document's active view by setting IMxDocument::ActiveView. Learn more by reading the help for this property.

  CoClasses that implement IActiveView

CoClasses and ClassesDescription
Globe (esriGlobeCore) A container for the display and manipulation of data in the Globe.
Map A container for the display and manipulation of map data.
PageLayout Page Layout class contains maps and map surrounds.
Scene (esri3DAnalyst) A container for the display and manipulation of data.

2. 属性和方法:

  Description
Method Activate Gives this view control of the specified window.
Method Clear Empties the view contents.
Method ContentsChanged Called by clients when view objects are modified.
Method Deactivate Another view takes over the associated window.
Method Draw Draws the view to the specified device context.
Read-only property ExportFrame The device rectangle to export.
Read/write property Extent The visible extent rectangle.
Read-only property ExtentStack The extent stack.
Read/write property FocusMap The map that tools and controls act on.
Read/write property FullExtent The full extent rectangle.
Method GetContextMenu Called when a context menu should be displayed at the given xy location. Return menu that should be displayed.
Read-only property GraphicsContainer The active graphics container.
Method HitTestMap Returns any maps present in the view at the given location. Return value may be zero if there are no maps or the coordinate is not over a map.
Method IsActive Indicates if view is active or not.
Read/write property IsMapActivated Indicates if the focus map is activated.
Method OnMessage Call from your application's message loop to enable automatic resizing and keyboard accelerators.
Method Output Renders the view to the specified DC.
Method PartialRefresh
(esriViewDrawPhase Phase, object Data, IEnvelope envelope)
Draws the specified view phase. Use an envelope of zero to draw the entire phase.
esriViewDrawPhase 枚举
参考:http://www.gisall.com/html/63/34963-3334.html
activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
Method PrinterChanged Called by application when printer changes.
Method Refresh Causes the entire view to draw.
Read-only property ScreenCacheID The screen cache ID that is used to draw the specified phase.
Read-only property ScreenDisplay
返回值:IScreenDisplay
The screen display used by the view.
Read/write property Selection The selection.
Read/write property ShowRulers Indicates if rulers are visible.
Read/write property ShowScrollBars Indicates if scrollbars are visible.
Read/write property ShowSelection Indicates if selection is visible.
Read-only property TipText The tip text to display at the given location.

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G7个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IFillShapeElement 接口

1. IFillShapeElement is a generic interface implemented by all 2d elements (CircleElement, EllipseElement, PolygonElement, and RectangleElement).

  Use this interface when you want to retrieve or set the fill symbol being used by one of the fill shape elements.

  CoClasses that implement IFillShapeElement

CoClasses and ClassesDescription
CircleElement The Graphic Element to display Circles.
EllipseElement The Graphic Element to display Ellipses.
GeoEllipseElement (esriDefenseSolutions) The graphic element to display GeoEllipses.
GeoPolygonElement (esriDefenseSolutions) The graphic element for displaying GeoPolygons.
MultiPatchElement The MultiPatch Graphics Element CoClass.
PolygonElement The Graphic Element to display polygons.
RectangleElement The Graphic Element to display rectangles.
Text3DElement The Text3D Graphics Element CoClass.

2. 属性和方法:

 

  Description
Read/write property Symbol
返回值:IFillSymbol
Fill symbol this element uses to draw itself.

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G8个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IElement 接口

1. Provides access to members that control the Element.

  CoClasses that implement IElement

 

CoClasses and ClassesDescription
BmpPictureElement The Graphic Element to display BMP Pictures.
CircleElement The Graphic Element to display Circles.
DataGraphTElement (esriCartoUI) A container for the display and manipulation of data graph graphic element on the ArcMap layout view.
DisplacementLinkElement (esriEditorExt) The Graphic Element to display adjustment links.
EllipseElement The Graphic Element to display Ellipses.
EmfPictureElement The Graphic Element to display Emf Pictures.
FEGraphic (esriDefenseSolutions) A cached graphic that symbolizes a point based military object (feature or force element).
FrameElement The Frame element to provide a neatline or background.
GeoEllipseElement (esriDefenseSolutions) The graphic element to display GeoEllipses.
GeoPolygonElement (esriDefenseSolutions) The graphic element for displaying GeoPolygons.
GeoPolylineElement (esriDefenseSolutions) The graphic element for displaying GeoPolylines.
GifPictureElement Graphic Element to display GIF Pictures.
GroupElement The Group Graphic Element to display a group of graphic elements.
IdentityLinkElement (esriEditorExt) The Graphic Element to display identity links.
InkGraphic Ink Graphic Object.
Jp2PictureElement Graphic Element to display JPEG2000 Pictures.
JpgPictureElement Graphic Element to display JPG Pictures.
LineElement The Graphic Element to display lines.
MapFrame A graphic element for displaying maps.
MapSurroundFrame A graphic element for displaying map surrounds.
MarkerElement The Graphic Element to display markers.
MoleGroupElement (esriDefenseSolutions) Mole Group Element Class.
MultiPatchElement The MultiPatch Graphics Element CoClass.
OleFrame (esriArcMapUI) The OLE frame.
ParagraphTextElement The Graphic Element to display text which flows into an area geometry.
PictureElement Picture Graphic Element.
PMFTitleTextElement The Graphic Element to display dynamic PMF titles.
PngPictureElement Graphic Element to display PNG Pictures.
PolygonElement The Graphic Element to display polygons.
RectangleElement The Graphic Element to display rectangles.
显示矩形的图形要素。
IElement element = new RectangleElement();
TableFrame (esriEditorExt) Graphic Element to display table.
TemporalChartElement (esriTrackingAnalystUI) Controls elements of the temporal charts.
Text3DElement The Text3D Graphics Element CoClass.
TextElement The Graphic Element to display text.
TifPictureElement Graphic Element to display TIF Pictures.

2. 属性和方法:

  Description
Method Activate Prepare to display graphic on screen.
Method Deactivate ActiveView that graphics are displayed on is no longer visible.
Method Draw Draws the element into the given display object.
Read/write property Geometry Shape of the element as a geometry.
Method HitTest Indicates if the given x and y coordinates are contained by the element.
Read/write property Locked Indicates if the element is in a read-only state.
Method QueryBounds Bounds of the element taking symbology into consideration.
Method QueryOutline Bounds of the element taking symbology into consideration.
Read-only property SelectionTracker Selection tracker used by this element.

 ---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第G9个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IFrameProperties 接口

1. Provides access to members that control the General properties for a frame.

  CoClasses that implement IFrameProperties

CoClasses and ClassesDescription
BmpPictureElement The Graphic Element to display BMP Pictures.
EmfPictureElement The Graphic Element to display Emf Pictures.
FrameElement The Frame element to provide a neatline or background.
GifPictureElement Graphic Element to display GIF Pictures.
GroupElement The Group Graphic Element to display a group of graphic elements.
Jp2PictureElement Graphic Element to display JPEG2000 Pictures.
JpgPictureElement Graphic Element to display JPG Pictures.
LocatorRectangle A map locator rectangle.
MapFrame A graphic element for displaying maps.
MapSurroundFrame A graphic element for displaying map surrounds.
OleFrame (esriArcMapUI) The OLE frame.
Page The On Screen Page.
ParagraphTextElement The Graphic Element to display text which flows into an area geometry.
PictureElement Picture Graphic Element.
PngPictureElement Graphic Element to display PNG Pictures.
TableFrame (esriEditorExt) Graphic Element to display table.
TemporalChartElement (esriTrackingAnalystUI) Controls elements of the temporal charts.
TifPictureElement Graphic Element to display TIF Pictures.

2. 属性和方法:

  Description
Read/write property Background Frame background used by this element.
Read/write property Border Frame border used by this element.
Read/write property Shadow Frame shadow used by this element.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Ga个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMapFrame 接口

1. Provides access to the members that control the map element object.

  IMapFrame is the default interface for the MapFrame object.  The main purpose of the interface is to give the developer access to the map object  stored within the frame, and it's associated locator rectangles.

  Inherited Interfaces

Interfaces Description
IFrameElement Provides access to members that control the Frame element object.

  CoClasses that implement IMapFrame

CoClasses and Classes Description
MapFrame A graphic element for displaying maps.

2. 属性和方法:

   Description
Method AddLocatorRectangle Add a new locator rectangle to the data frame.
Read/write property Background Frame background used by this element.
Read/write property Border Frame border used by this element.
Read/write property Container The frame's container.
Method CreateSurroundFrame Returns the map surround frame element of the type given in clsid. An optional style object may be specified.
Read/write property DraftMode Indicates if this element is in draft mode, i.e., draws fast.
Read/write property ExtentType The way in which the map extent of the frame is specified.
Method LocatorRectangle Returns the locator rectangle at the specified index.
Read-only property LocatorRectangleCount The number of locator rectangles.
Read/write property Map The associated map.
Read/write property MapBounds The bounds of the map displayed by the frame.
Read/write property MapScale The scale at which the map should be displayed.
Read-only property Object Object framed by this element.
Method RemoveAllLocatorRectangles Remove all the locator rectangles from the data frame.
Method RemoveLocatorRectangle Remove a locator rectangle from the data frame.
Read-only property Thumbnail Small bitmap representation of this element.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gb个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMapGrid 接口

1. Provides access to members that control a map grid.

  IMapGrid is the main interface for setting properties that apply to all other types of grids. There are four specific types of MapGrid that all implement the IMapGrid interface. They are: IMeasuredGrid , IGraticule , IndexGrid , and ICustomGridOverlay .

  CoClasses that implement IMapGrid

CoClasses and Classes Description
CustomOverlayGrid A custom map grid.
Graticule A map grid that divides the map with meridians and parallels.
IndexGrid A map grid that divides the map into a grid for indexing.
MeasuredGrid A map grid that divides the map into a grid of units in any coordinate system.
MgrsGrid The Military Grid Reference System (MGRS) object.

2. 属性和方法:

   Description
Read/write property Border The map grid border.
Method Draw Draws the map grid for a map frame to the given display.
Read-only property ExteriorWidth The width (in display units) of the portion of the grid that is outside of the frame.
Method GenerateGraphics Generates graphic elements corresponding to the grid lines and stores them in the specified graphics container.
Read/write property LabelFormat The label format for map grid labels.
Read/write property LineSymbol The symbol used to draw grid lines - null will draw no lines.
Read/write property Name The name of the map grid.
Method PrepareForOutput Prepares the map grid for output to a device.
Method QueryLabelVisibility Returns the visibility of the labels along all four sides of the map grid.
Method QuerySubTickVisibility Returns the visibility of the subticks along all four sides of the map grid.
Method QueryTickVisibility Returns the visibility of the ticks along all four sides of the map grid.
Method SetDefaults Sets the properties of the map grid to default values.
Method SetLabelVisibility Sets the visibility of the labels along all four sides of the map grid.
Method SetSubTickVisibility Sets the visibility of the subticks along all four sides of the map grid.
Method SetTickVisibility Sets the visibility of the ticks along all four sides of the map grid.
Read/write property SubTickCount The number of subticks to draw between the major ticks.
Read/write property SubTickLength The length of the subticks in points.
Read/write property SubTickLineSymbol The symbol used to draw the subtick lines.
Read/write property TickLength The length of the major ticks in points.
Read/write property TickLineSymbol The line symbol used to draw the major ticks.
Read/write property TickMarkSymbol The symbol used to draw tick marks at the grid interval intersections - null will draw no tick marks.
Read/write property Visible Indicates if the map grid is visible.

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gc个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMapGrids 接口

1. Provides access to members that control the map grids in a data frame.

  IMapGrids is implemented only by the MapFrame object, but it is not the default interface for that object (IMapFrame is the default).  Use this interface when you want to retrieve or set the grids (sometimes known as graticules) displayed with a particular MapFrame.  The Grids are used to provide reference information for the map.

  CoClasses that implement IMapGrids

CoClasses and Classes Description
MapFrame A graphic element for displaying maps.

2. 属性和方法:

   Description
Method AddMapGrid Adds a map grid to the map frame.
Method ClearMapGrids Clears all map grids from the map frame.
Method DeleteMapGrid Deletes a map grid from the map frame.
Read/write property MapGrid The map grid at the specified index.
Read-only property MapGridCount The number of map grids associated with the map frame.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gd个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ISelectionEnvironment 接口

1. Provides access to members that control the selection environment.

  CoClasses that implement ISelectionEnvironment

CoClasses and Classes Description
SelectionEnvironment Defines the feature selection environment.

2. 属性和方法:

   Description
Read/write property AreaSearchDistance Distance used for selecting areas by proximity.
Read/write property AreaSelectionMethod Selection method used for areas.
Read/write property CombinationMethod Combination method for the selection results.
Read/write property DefaultColor Default selection color.
Read/write property LinearSearchDistance Distance used for selecting lines by proximity.
Read/write property LinearSelectionMethod Selection method used for lines.
Read/write property PointSearchDistance Distance used for selecting points by proximity.
Read/write property PointSelectionMethod Selection method used for points.
Read/write property SearchTolerance Search tolerance in device units.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Ge个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IPage 接口

1. Provides access to members that control the Page.

private void button2_Click(object sender, EventArgs e)
{
    ColorDialog cd = new ColorDialog();
    cd.ShowDialog();
    IPage pPage = axPageLayoutControl1.PageLayout.Page;
    IRgbColor pColor = new RgbColor();
    pColor.Red = cd.Color.R;
    pColor.Green = cd.Color.G;
    pColor.Blue = cd.Color.B;
    pPage.BackgroundColor = pColor;
}

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gf个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ISnapGrid 接口

1. Provides access to members that control the Snapping grid.

private void button3_Click(object sender, EventArgs e)
{
    ISnapGrid pSnapGrid = axPageLayoutControl1.PageLayout.SnapGrid;
    pSnapGrid.VerticalSpacing = .2;
    pSnapGrid.HorizontalSpacing = .1;
    pSnapGrid.IsVisible = true;
    axPageLayoutControl1.ActiveView.Refresh();
}

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gg个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ISnapGuides 接口

1. Provides access to members that control the Snapping guides.

private void button4_Click(object sender, EventArgs e)
{
    ISnapGuides pSnapGuides = axPageLayoutControl1.PageLayout.HorizontalSnapGuides;
    for (int i = 0; i < 30;i++ )
    {
        pSnapGuides.AddGuide(i);
    }
    pSnapGuides.AreVisible = true;
    ISnapGuides pSnapGuides2 = axPageLayoutControl1.PageLayout.VerticalSnapGuides;
    for (int i = 0; i < 20;i++ )
    {
        pSnapGuides2.AddGuide(i);
    }
    pSnapGuides2.AreVisible = true;
    axPageLayoutControl1.ActiveView.Refresh();
}

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gh个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IRulerSettings 接口

1. Provides access to members that control Ruler setup.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gh个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IRulerSettings 接口

1. Provides access to members that control Ruler setup.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gi 个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IRulerSettings 接口

1. Provides access to members that control Ruler setup.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Gj 个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IRulerSettings 接口

1. Provides access to members that control Ruler setup.

---------------------------------------------------------------------------------------------------------

●·● Controls 命名空间

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U1个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● LicenseControl 类

1. 用来给控件提供许可,并不现实在程序上。

2. Using the LicenseControl.

3. How to programmatically handle LicenseControl initialization failure.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U2个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● MapControl 类

1. MapControl 控件封装了 Map 对象,并提供了其他的属性、方法和事件,用于管理控件的外观、显示属性和地图属性,管理、添加数据图层,装载地图文挡,显示、绘制跟踪图层。MapControl上存在着诸如 TrackRectangle 、TrackPolygon 、TrackLine 和 TrackCircle 等帮助方法,用于追踪或" 橡皮圈住( rubber banding )"显示上的几何图形( Shape )。VisibleRegion 属性可用于更改MapControl 显示区内的几何图形。MapControl 控件实现的主要接口有IMapControlDefault 、IMapControl2 、IMapControl3 、lMapConlrolEvents2 等

2. Using the MapControl.

3. How to get started with the MapControl property pages.

4. How to enable arrow key and mouse wheel navigation of the map display.

axMapControl1.KeyIntercept = (int)esriKeyIntercept.esriKeyInterceptArrowKeys;
axMapControl1.AutoKeyboardScrolling = true;
axMapControl1.AutoMouseWheel = true;

5. How to rotate the MapControl display.

6. How to drop data onto the MapControl. 从其他窗口拖拽数据!

7. Displaying MapTips in the MapControl.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U3个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMapControl2 类

1. The IMapControl2 interface is a starting point for any tasks related to the MapControl, such as setting general appearance, setting map and display properties, adding and managing data layers and map documents, and drawing and tracking shapes.

2. 属性和方法:

  属性和方法Description
Method AboutBox Displays a dialog of information about the MapControl.
Read-only property ActiveView The active view of the Map contained by the MapControl.
Method AddLayer
(ILayer Layer, int toIndex)
Adds a layer to the Map's collection of layers at the specified index position.
Method AddLayerFromFile
(string lyrPath, int toIndex)
Loads a layer file and adds it to the Map's collection of layers at the specified index position.
默认为 0,toIndex 限制所处涂层的位置!
Method AddShapeFile
(string Path, string fileName)
Adds a shapefile as a layer to the Map.
添加 Shapefile 文件!
Read/write property Appearance The appearance of the MapControl.
Read/write property BackColor Background color of the MapControl.
Read/write property BorderStyle The border style of the MapControl.
Method CenterAt Moves the center of the MapControl to the specified location.
指的是以地理坐标为中心。
IPoint point = new ESRI.ArcGIS.Geometry.Point();  //定义点
point.PutCoords(e.mapX, e.mapY);  //给点赋值
axMapControl3.CenterAt(point);  //操作方法
Method CheckMxFile
(string fileName)
Checks the specified filename to see if it is a map document that can be loaded into the MapControl.
判断是否为 *.mxd 文件。

Method ClearLayers Removes all layers from the Map.
Read/write property CurrentTool Current active tool for the MapControl. Set to nothing to clear the tool.
Method DeleteLayer
(int index)
Removes a Layer from the Map's collection of layers at the specified index position.
for (int i = axMapControl1.LayerCount - 1; i >= 0;i--)
axMapControl1.DeleteLayer(i); //倒序,删除所有图层!
Method DrawShape
(IGeometry, ref object symbol)
Draws a geometry shape on the MapControl.
Method DrawText
(IGeometry pGeometry, string text, ref object pSymbol)
Draws text along the supplied geometry.
Read/write property Enabled Indicates whether the MapControl can respond to user generated events.
Read/write property Extent
IEnvelope
Current extent of the Map in map units.
对于相同地图来说,即使在不同的 MapControl 中,但是相同区域的长和宽都是相同的!通过这个特点,可以很容易的实现让两个 MapControl 显示相同哦内容!
        private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e)
{  //触发同步事件
axMapControl2.Extent = axMapControl1.Extent;  //让1和2之间建立联系,保证显示相同的地图。
}

//获取当前地图中心点的坐标,通过四个端点的坐标来反推中心点的坐标!

  IPoint centerPoint = new ESRI.ArcGIS.Geometry.Point();
  centerPoint.X = (pEnv.XMin + pEnv.XMax) / 2;
  centerPoint.Y = (pEnv.YMin + pEnv.YMax) / 2;
Method FlashShape
(IGeometry pShape, int nFlashes, int flashInterval, object symbol)

Flashes a shape on the MapControl, duration is in milliseconds.
第一个参数表示几何形状;
第二个参数表示闪烁的次数;
第三个参数表示闪烁的间隔;
第四个参数表示样式。

Method FromMapPoint Converts a point on the Map (in map units) to device co-ordinates (typically pixels).
Read/write property FullExtent Rectangular shape that encloses all features of all layers in the Map.
Read-only property hWnd Handle to the window associated with the MapControl.
Read-only property Layer
属性:Layer [int index]
方法:get_Layer (int index)
Layer at the supplied index.
Read-only property LayerCount Number of layers in the Map.
Method LoadMxFile
(string mxPath, object mapNmeOrIndex, object password)
Loads the specified Map from the map document into the MapControl. The Map can be an index or a name, if it is not supplied the focus map is used.
加载 *.mxd 文件。(Type.Missing 默认值)
axMapControl1.LoadMxFile(filePath, Type.Missing, Type.Missing);
axMapControl1.LoadMxFile(filePath, 0, Type.Missing);  //加载第一个框架
axMapControl1.LoadMxFile(filePath, 1, Type.Missing);  //加载第二个框架
axMapControl1.LoadMxFile(filePath, "China", Type.Missing);  //加载名称为China的框架
Read/write property Map The Map contained by the MapControl.
Read/write property MapScale Scale of the map as a representative fraction.
Read/write property MapUnits The geographical units of the map.
Read/write property MouseIcon Custom mouse icon used if MousePointer is 99.
Read/write property MousePointer The mouse pointer displayed over the MapControl.
esriControlsMousePointer 枚举:鼠标的不同显示样式!(箭头小圆圈)
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass;
Method MoveLayerTo
(int fromIndex, int toIndex)
Moves a layer within the Map's collection from its current index position to a new index position.
若向下移动,则其上的整体上移,若向上移动,则其下整体下移。
Read/write property OleDropEnabled Indicates if the MapControl will fire events when data is dragged over the control's window.
Method Pan Tracks the mouse while panning the MapControl.
实现在 MapControl 上面漫游。
Method ReadMxMaps Opens a map document specified by the supplied filename and reads the maps into an array object.
Read/write property ReferenceScale Reference scale of the Map as a representative fraction.
Method Refresh Redraws the Map, optionally just redraw specified phases or envelope.
Read/write property Rotation
(double Rotation)
Determines how many degrees the map display is rotated.
旋转的角度,相对于最初位置而言的!下面实现在 0 ° 和 180° 之间切换!
if (axMapControl1.Rotation == 0)
{
    axMapControl1.Rotation = 180;
    axMapControl1.ActiveView.Refresh();
}
else
{
    axMapControl1.Rotation = 0;
    axMapControl1.ActiveView.Refresh();
}
Read/write property ShowScrollbars Indicates whether or not the Map's scrollbars are visible.
Read/write property SpatialReference Spatial reference of the Map.
Method ToMapPoint Converts a point in device co-ordinates (typically pixels) to a point on the Map (in map units).
Read/write property TrackCancel The object used by the MapControl to check if drawing has been aborted.
Method TrackCircle Rubber-bands【橡皮筋】 a circle on the MapControl.
Method TrackLine
IGeometry
Rubber-bands a polyline on the MapControl.
用鼠标在 MapControl 上画折线。
Method TrackPolygon Rubber-bands a polygon on the MapControl.
画 Polyline & 画 Circle
        int flag = 0;
Random r = new Random();
private void button1_Click(object sender, EventArgs e)
{
flag = 1;
}
private void button2_Click(object sender, EventArgs e)
{
flag = 2;
}
private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
{
axMapControl1.MousePointer = esriControlsMousePointer.esriPointerCrosshair;
IGeometry geometry = null;
if (flag == 1)
{
geometry = axMapControl1.TrackLine();
object symbol = null;

IRgbColor pRgbColor = new RgbColor();
pRgbColor.Red = (int)r.Next(255);
pRgbColor.Green = (int)r.Next(255);
pRgbColor.Blue = (int)r.Next(255);

ISimpleLineSymbol pSympleLineSymbol = new SimpleLineSymbol();
pSympleLineSymbol.Color = pRgbColor;
pSympleLineSymbol.Width = 1;

symbol = pSympleLineSymbol;
axMapControl1.DrawShape(geometry, ref symbol);
}
else if (flag == 2)
{
geometry = axMapControl1.TrackCircle();
object symbol = null;

IRgbColor pRgbColor = new RgbColor();
pRgbColor.Red = (int)r.Next(255);
pRgbColor.Green = (int)r.Next(255);
pRgbColor.Blue = (int)r.Next(255);

ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbol();
pSimpleFillSymbol.Color = pRgbColor;

symbol = pSimpleFillSymbol;
axMapControl1.DrawShape(geometry,ref symbol);
}
}
Method TrackRectangle
IGeometry
Rubber-bands a rectangle on the MapControl.
用鼠标在 MapControl 上拉出一个矩形。
Write-only property VisibleRegion The geometry specifying the visible region of the Map.

KeyIntercept:A property that specifies interception of key strokes that are normally handled by the container. When intercepted the OnKeyDown and OnKeyUp events will be called. This value can be a combined bit mask of esriKeyIntercept enum values.
AutoKeyboardScrolling:Indicates whether keyboard scrolling is enabled.
AutoMouseWheel:Indicates whether the mouse wheel is enabled.

axMapControl1.KeyIntercept = (int)esriKeyIntercept.esriKeyInterceptArrowKeys;  //接收方向键
axMapControl1.AutoKeyboardScrolling = true;  //允许使用键盘
axMapControl1.AutoMouseWheel = false;    //允许使用鼠标中建

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U4个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMapControl4 类

1. 属性和方法:

  • DocumentFilename:The filename of the last map document loaded into the control. 文档的文件全名。
                MessageBox.Show(axMapControl1.DocumentFilename);
  • DocumentMap:The name of the map that was last loaded into the control from a map document. 地图名称。
  • KeyIntercept:返回或设置 MapControl 截取键盘按键信息。
  • Object:返回 MapControl 控件。
  • ShowMapTips:Indicates if map tips are shown.
  • CustomProperty:个人理解,很神奇的一个属性,就是内部记录N多东西,只要给他强制类型转换,就可以指定的东西,前提是它里面有这个东西!

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U5个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IMapControlEvents2 类

1. Provides access to events that occur with interaction to the MapControl.

  This is the main events interface for the MapControl. Generally there is no need to explicitly set event handlers, as most development environments will automatically provide event handlers.

2. 事件:

  事件Description
Event OnAfterDraw Fires after the Map draws a specified view phase.

Event OnAfterScreenDraw Fires after the Map contained by the MapControl has finished drawing.
效果好像和 OnExtentUpdated 比较类似!
不同点就是 OnAfterScreenDraw 是在操作之后才触发,而 OnExtentUpdated 是只要有范围变化即会触发,因此用前者的时候消耗资源更少,特别是在 MapControl 和 PageLayoutControl 交互的时候表现的更明显!
Event OnBeforeScreenDraw Fires before the Map contained by the MapControl starts to draw.
Event OnDoubleClick Fires when the user presses and releases the mouse button twice in quick succession.
Event OnExtentUpdated
参数:e
(object displayTransformation, bool sizeChanged, object newEnvelope)

Fires after the extent (visible bounds) of the MapControl is changed.
当 MapControl 的地图可视边界范围变化的时候触发!
其中 newEnvelope 指的是 鼠标画的区域,若是通过滚轮放大缩小,则指的是 当前屏幕的区域。
Envelope 的大小是指地图中矩形的相对大小,当放大地图的时候,虽然同样是 Extent,但是 Envelope 的 Width 和 Height 属性都会缩小,同样的大小的矩形,随着比例尺的大小不同,Envelope的属性也会发生变化!

Event OnFullExtentUpdated Fires after the full extent (bounds) of the MapControl has changed.
当地图的覆盖范围变化时触发,例如,往地图中新增加一个图层,其覆盖范围大于原图的范围。
Event OnKeyDown Fires after a key is pressed on the keyboard.
Event OnKeyUp Fires after a pressed key is released.
Event OnMapReplaced Fires after the Map contained by the MapControl has been replaced.
当 MapControl 的 mxd 文件替换时候触发事件!【鹰眼】
Event OnMouseDown






Fires when the user presses any mouse button while over the MapControl.
在 MapControl 上面点击鼠标上面任何一个键触发事件!
e.button = 1  表示 左键。
e.button = 2  表示 右键。
e.button = 4  表示 中键。
e.x  表示 像素横坐标。
e.y  表示 像素纵坐标。
e.MapX  表示 地图横坐标。
e.MapY  表示 地图纵坐标。
label1.Text = "MapX:" + string.Format("{0:0.00000}", e.mapX).PadLeft(10) + "°";
label2.Text = "MapY:" + string.Format("{0:0.00000}", e.mapY).PadLeft(10) + "°";
label3.Text = "X:" + e.x.ToString().PadLeft(5);
label4.Text = "Y:" + e.y.ToString().PadLeft(5);
Event OnMouseMove Fires when the user moves the mouse over the MapControl.
当鼠标在 MapControl 上面漫游的时候触发!
Event OnMouseUp Fires when the user releases a mouse button while over the MapControl.
Event OnOleDrop Fires when an OLE drop action occurs on the MapControl.
Event OnSelectionChanged Fires when the current selection changes.
Event OnViewRefreshed Fires when the view is refreshed before drawing occurs.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U6个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● PageLayoutControl 类

1. PageLayoutControl 控件主要用于页面布局与和制图。该控件封装了 PageLayout 类,提供了布局视图中控制元素的属性和方法,以及其他的事件、属性和方法。

  • Printer 属性提供了处理地图打印的设置。
  • Page 属性提供了处理控件的页面效果。
  • Element 属性则用于管理控件中的地图元素。
  • PageLayoutControl 控件不能添加地图图层或地理数据,必须通过使用MXD 文件来加载需要处理的数据。PageLayoutControl 控件主要实现IPageLayoutControlDefaut、IPageLayoutControl 、IPageLayoutControl2 、IPageLayoutControlevents 等接口。

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U7个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IPageLayoutControl 类

1. Provides access to members that control the PageLayoutControl. Note: the IPageLayoutControl interface has been superseded byIPageLayoutControl3. Please consider using the more recent version.

  The IPageLayoutControl interface is a starting point for any tasks related to the PageLayoutControl, such as setting general appearance, setting page and display properties, adding and finding elements, loading map documents, and printing.

  CoClasses that implement IPageLayoutControl

CoClasses and ClassesDescription
PageLayoutControl ESRI PageLayoutControl

2. 属性和方法:

  Description
Method AboutBox Displays a dialog of information about the PageLayoutControl.
Read-only property ActiveView The active view of the PageLayout contained by the PageLayoutControl.
Method AddElement Adds the supplied element to the PageLayout, with optional geometry, symbolization, name and Z order.
Read/write property Appearance The appearance of the PageLayoutControl.
Read/write property BackColor Background color of the PageLayoutControl.
Read/write property BorderStyle The border style of the PageLayoutControl.
Method CenterAt Moves the center of the PageLayoutControl to the specified location.
Method CheckMxFile Checks the specified filename to see if it is a map document that can be loaded into the PageLayoutControl.
Read/write property CurrentTool Current active tool for the PageLayoutControl. Set to nothing to clear the tool.
Read/write property Enabled Indicates whether the PageLayoutControl can respond to user generated events.
Read/write property Extent Current extent of the PageLayout in page units.
此 Extent 所表示的是那个 Layout 的外框范围,所以外框放的越大,则 Extent 越小,这里的 Extent 与 MapControl 中的 Extent 没办法建立联系,因为所控制的东西不同!
Method FindElementByName Find the first element with the supplied name, supply an occurrence parameter to find the second, third and so on.
Method FromPagePoint Converts a point on the page (in page units) to device co-ordinates (typically pixels).
Read/write property FullExtent Rectangular shape that encloses the PageLayout.
Read-only property GraphicsContainer The graphics container of the PageLayout object contained by the PageLayoutControl.
Read-only property hWnd Handle to the window associated with the PageLayoutControl.
Method LoadMxFile Loads the specified map document into the PageLayout contained by the PageLayoutControl.
Method LocateFrontElement Locates an element at the given page co-ordinates. If more than one element is at the location the element nearest the front is returned.
Read/write property MouseIcon Custom mouse icon used if MousePointer is 99.
Read/write property MousePointer The mouse pointer displayed over the PageLayoutControl.
Read/write property OleDropEnabled Indicates if the PageLayoutControl will fire events when data is dragged over the control's window.
Read-only property Page The Page associated with the PageLayout contained by the PageLayoutControl.
Read/write property PageLayout The PageLayout contained by the PageLayoutControl.
Method Pan Tracks the mouse while panning the PageLayoutControl.
Read/write property Printer The printer object used by the PageLayoutControl for printing.
Read-only property PrinterPageCount The number of printer pages the PageLayout will cover.
Method PrintPageLayout Sends the specified range of pages on the printer.
Method Refresh Redraws the PageLayout, optionally just redraw specified phases or envelope.
Method ToPagePoint Converts device co-ordinates (typically pixels) to a point on the page (in page units).
Read/write property TrackCancel The object used by the PageLayoutControl to check if drawing has been aborted.
Method TrackRectangle Rubber-bands a rectangle on the PageLayoutControl.
Method ZoomToWholePage Changes the extent of the PageLayout to show a whole page.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U8个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IPageLayoutControlEvents 类

1. Provides access to events that occur with user interaction to the PageLayoutControl.

  CoClasses that implement IPageLayoutControlEvents

CoClasses and ClassesDescription
PageLayoutControl ESRI PageLayoutControl
PageLayoutControlEventsListener (esriSystemUtility) Helper coclass to provide IPageLayoutControlEvents support to the C++ API.

 

2. 属性和方法:

  Description
Event OnAfterDraw Fires after the PageLayoutControl draws a specified view phase.
Event OnAfterScreenDraw Fires after the PageLayout contained by the PageLayoutControl has finished drawing.
Event OnBeforeScreenDraw Fires before the PageLayout contained by the PageLayoutControl starts to draw.
Event OnDoubleClick Fires when the user presses and releases the mouse button twice in quick succession.
Event OnExtentUpdated Fires after the extent (visible bounds) of the PageLayoutControl is changed.
Event OnFocusMapChanged Fires when the current focus map in the PageLayoutControl has been switched to a new map.
Event OnFullExtentUpdated Fires after the full extent (bounds) of the PageLayoutControl has changed.
Event OnKeyDown Fires after a key is pressed on the keyboard.
Event OnKeyUp Fires after a pressed key is released.
Event OnMouseDown Fires when the user presses any mouse button while over the PageLayoutControl.
Event OnMouseMove Fires when the user moves the mouse pointer over the PageLayoutControl.
Event OnMouseUp Fires when the user releases a mouse button while over the PageLayoutControl.
Event OnOleDrop Fires when an OLE drop action occurs on the PageLayoutControl.
Event OnPageLayoutReplaced Fires after the PageLayout object used by the PageLayoutControl has been replaced.
Event OnPageSizeChanged Fires when the Page associated with the PageLayout has had its size changed.
Event OnViewRefreshed Fires when the view is refreshed before drawing occurs.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第U9个     ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ToolbarControl 类

1. ToolbarControl 包括6个对象及相关接口: ToolbarControl 、ToolbarItem 、ToolbarMenu 、CommandPool 、CustomizeDialog 、MissingCommand。ToolbarControl 要与一个"伙伴控件"协同工作。通过ToolbarControl 属性页设置,或者在驻留ToolbarControl 的容器被显示时用SetBuddyControl 方法通过编程设置。

  ToolbarControl 的每个"伙伴控件"都实现了 IToolbarBuddy 接口,这个接口用于设置"伙伴控件"的 CurrentTool 属性。如通过设置 MapControl 作为其"伙伴控件",当用户单击该 ToolbarControl 上的"拉框放大" 工具时,该放大工具就会成为 MapControl 的 CurrentTool 。放大工具的实现过程是:通过ToolbarControl 获取其"伙伴控件",然后在 MapControl 上提供显示终端用户按动鼠标所画的框,并改变 MapControl 的显示范围。ToolbarControl 一般要与一个"伙伴控件"协同工作,并有一个控件命令选择集,以便快速提供功能强大的GIS 应用程序。ToolbarControl 不仅提供了部分用户界面,而且还提供了部分应用程序框架。ArcGIS Desktop 应用程序,如 ArcMap 、ArcGlobe 和 ArcScene 等具有强大而灵活的框架,包括诸如工具条、命令、菜单、泊靠窗口和状态条等用户界面组件,这些框架使终端用户可以通过改变位置、添加利删除这些用户界面组 件来定制应用程序。

  ArcGIS Engine 提供了几套使用 ArcGIS 控件的命令,以便执行某种特定动作,开发人员可通过创建执行特定任务的定和l命令来扩展这套控件命令。所有的命令对象都实现了 ICommand 接口,ToolbarControl 在适当的时候要使用该接口来调用方法和访问属性。在命令对象被驻留到 ToolbarControl 后,就会立即调用 ICommand: :OnCreate 方法,这个方法将一个句柄(Handle) 或钩子(hook)传递给该命令操作的应用程序。命令的实现一般都要经过测试,以查看该钩子(hook)对象是否被支持.如果不支持则该钩子自动失效,如 果支持,命令则存储该钩子以便以后使用。ToolbarControl 使用钩子(hook) 来联系命令对象和..伙伴控件",并提供了属性、方法和事件用于管理控件的外观,设置伙伴控件,添加、删除命令项,设置当前工具等。 ToolbarControl 的主要接口有: IToolbarControl 、IToolbarControlDefault、IToolbarControlEvents。

  (1) IToolbarControl: 该接口是任何与 ToolbarControl 有关的任务的出发点,如设置"伙伴控件"的外观,设置伙伴控件,添加或去除命令、工具、菜单等。

   (2) ITooJbarControlDefault: 该接口是自动暴露的缺省的 dispatch 接口,该接口的属性和方法与 ToolbarControl 的最高版本主接口的属性、方法相同。例如目前版本中的 IToolbarControlDefault 等同于 IToolbarControl .但在今后的新版本中,可能会变为 IToolbarControl2 。在开发中使用 IToolbarControlDefault 接口,能够保证总是访问到最新版本的ToolbarControl。

  (3) IToolbarControlEvents: 该接口是一个事件接口,定义了 ToolbarControl 能够处理的全部事件,如 OnDoubleClick、OnltemClick、OnKeyDown 等。

  在ToolbarControl 上可以驻留以下3 类命令。

   (1)实现了响应单击事件的 ICommand 接口的单击命令。用户单击事件, 会导致对 ICommand : :OnClick 方法的调用,并执行某种动作。通过改变ICommand: :Checked 属性的值,简单命令项的行为就像开关那样。单击命令是可以驻留在菜单中的惟一命令类型。

  (2)实现了 ICommand 接口和 ITool 接口、需要终端用户与"伙伴控件"的显示进行交互的工具。ToolbarControl 维护 CurrentTool 属性。当终端用户单击ToolbarControl 上的工具时,该工具就成为 CurrentTool。ToolbarControl 会设置"伙伴控件"的 CurrentTool 属性。当某个工具为 CurrentTool 时,该工具会从"伙伴控件"收到鼠标和键盘事件。

   (3)实现了 ICommand 接口和 IToolControl 接口的工具控件。这通常是用户界面组件。ToolbarControl 驻留了来自 ItoolControl: hWnd 属性窗口句柄提供的一个小窗口,只能向 ToolbarControl 添加特定工具控件的一个例程。

  可以使用3 种方法向 ToolbarControl 添加命令,第1 种是指定唯一识别命令的一个UID ,第2 种是指定一个 progID,第3 种是给 AddToolbarDef 方法提供某个现有命令对象的一个例程。下面给出样例代码。

//Add a toolbardef by passing a UIO
UID uID = new UIDClass();
uID.Value = "esriControls.ControlsMapNavigationToolbar";
axToolbarControl1.AddToolbarDef(uID, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);

//Add a toolbardef by passing a ProgID
string progID = "esriControls.ControlsMapNavigationToolbar";
axToolbarControl1.AddToolbarDef(progID, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);

//Add a toolbardef by passing an IToolbarDef
IToolBarDef toolBarDef = new ControlsMapNavigationToolbarClass();
axToolbarControl1.AddToolbarDef(toolBarDef, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);

   ToolbarControl 更新命令的使用。默认情况下,ToolbarControl 每半秒钟自动更新一次,以确保驻留在 ToolbarControl 上的每个工具条命令项的外观与底层命令的 Enabled 、Bitmap 、Caption 等属性同步。改变 Updatelnterval 属性可以更改更新频率。Updatelnterval 为0会停止任何自动发生的更新,可以通过编程调用 Update 方法以刷新每个工具条命令项的状态。

  在应用程序中首次调用 Update 方法时,ToolbarControl 会检查每个工具条命令项的底层命令的 ICommand: :OnCreate 方法是否已经被调用过,如果还没有调用过该方法,该 ToolbarCommand 将作为钩子被自动传递给 ICommand: :OnCreate 方法。

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Ua个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IToolbarControl2 类

  Member:

  Description
Method AboutBox Displays a dialog of information about the ToolbarControl.
Method AddItem Adds an item to the ToolbarControl.
增加单个工具或是命令!或是 ToolPalette!
Method AddMenuItem Adds a menu item to the ToolbarControl.
增加菜单项!
Method AddToolbarDef Appends the contents of the toolbar definition, specified by Guid or ToolbarDef, to the toolbar control.
Read/write property Appearance The appearance of the ToolbarControl.
Read/write property BorderStyle The border style of the ToolbarControl.
Read-only property Buddy The object that will have its current tool managed by the toolbar.
Read/write property CommandPool The command pool used by the ToolbarControl to manage command objects. The command pool object maybe shared with other ToolbarControls and ToolbarMenus.
Read-only property Count The number of items on the ToolbarControl.
Read/write property CurrentTool The current tool of the buddy.
Read/write property Customize Indicates if the ToolbarControl is in customize mode.
Read/write property CustomProperty A property to associate data with a control.
Read/write property Enabled Indicates whether the ToolbarControl can respond to user generated events.
Method Find Returns the index of the first item containing the given command, menu or palette. Returns -1 if the command is not found.
Method GetItem Returns the item at the specified index from the ToolbarControl.
Method GetItemRect Returns the dimensions of the item at the specified index.
Method HitTest Returns the index of the item at the specified x and y coordinates.
Read-only property hWnd Handle to the window associated with the ToolbarControl.
Read/write property ItemAppearance The appearance of the items on the ToolbarControl.
Read/write property KeyIntercept A property that specifies interception of key strokes that are normally handled by the container. When intercepted the OnKeyDown and OnKeyUp events will be called. This value can be a combined bit mask of esriKeyIntercept enum values.
Read/write property LargeIcons Indicates if large icons are shown on all items on the ToolbarControl.
Read/write property MenuTracking Indicates if menu tracking is enabled on the ToolbarControl.
Read/write property MouseIcon Custom mouse icon used if MousePointer is 99.
Read/write property MousePointer The mouse pointer displayed over the ToolbarControl.
Method MoveItem Moves an item from one index to another.
Read-only property Object A property that returns the underlying control. This can be used when the control is inside a wrapper object that has been added by a development environment.
Read/write property OperationStack The operation stack used for undo and redo functionality. If present commands can use it to store operations.
Method Remove Removes the item at the specified index from the ToolbarControl.
Method RemoveAll Removes all items from the ToolbarControl.
Method SetBuddyControl Sets a control to be a buddy of the toolbar, this control must support IToolbarBuddy.
Read/write property TextAlignment The caption placement for all items on the ToolbarControl.
Read/write property ToolTips Indicates if the items tooltips are shown.
Method Update Updates the enabled state of the specified item or all items if an index of -1 is specified. Specify fullUpdate to update the group, group spacing, style and bitmap properties.
Read/write property UpdateInterval The frequency in millisecs that update method is called on the ToolbarControl.

 

---------------------------------------------------------------------------------------------------------

 

            ╔════════╗
╠════╣    第Ub个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● TOCControl 类

1. TOCControl 是用来管理图层的可见性和标签的编辑。TOCControl 需要一个"伙伴控件",或实现了IActiveView 接口的对象协同工作。"伙伴控件"可以是MapControl 、PageLayoutControl 、ReaderControl 、SceneControl 或GlobeControl。"伙伴控件" 可以通过TOCControl 属性页设置,或者在驻留TOCControl 的容器被显示时用SetBuddyControl 方法通过编程设置。TOCControl 的每个"伙伴控件"都实现了 ITOCBuddy 接口。TOCControl 用"伙伴控
件"来显示其地图、图层和符号体系内容的一个交互树视图,并保持其内容与"伙伴控件"同步。TOCControl 通过 ITOCBuddy 接口来访问其"伙伴控件" 。

  TOCControl 的主要接口有两个,一个是 ITOCControl,一个是 ITOCControlEvents。ITOCControl 接口是任何与 TOCControl 有关的任务的出发点,如设置控件的外观、设置"伙伴控件" 、管理图层的可见性和标签的编籍等。ITOCControlEvents 是一个事件接口,它定义了 TOCControl 能够处理的全部事件,如OnMouseDown 、OnMouseMove 、OnMouseUp 等,这些事件在构建独立应用程序中经常使用,如 OnBeginLabelEdit 、OnEndLabelEdit 分别是TOCControl 中的标签开始编箱、结束编辑时触发。

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Uc个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ITOCControl 接口

1. Provides access to members that control the TOCControl. Note: the ITOCControl interface has been superseded byITOCControl2. Please consider using the more recent version.

   The ITOCControl interface is a starting point for any tasks related to the TOCControl such as setting the general appearance, setting the Buddy control, and managing layer visibility and label editing.

  CoClasses that implement ITOCControl

CoClasses and ClassesDescription
TOCControl ESRI TOCControl

 

2. 属性和方法:

  Description
Method AboutBox Displays a dialog of information about the TOCControl.
显示此控件的一些信息!弹出窗口!
Read-only property ActiveView The ActiveView used to populate the TOCControl.
Read/write property Appearance The appearance of the TOCControl.
Read/write property BorderStyle The border style of the TOCControl.
Read-only property Buddy The object whose ActiveView is used to populate the TOCControl.
Read/write property CustomProperty A property to associate data with a control.
Read/write property Enabled Indicates whether the TOCControl can respond to user generated events.
Method HitTest
(int X, int Y, ref esriTOCControlItem ItemType, ref IBasicMap BasicMap, ref ILayer Layer, ref object Unk, ref object Data)
Returns the item in the TOCControl at the specified coordinates.
esriTOCControlItem 枚举:返回样式
IBasicMap:绑定 MapControl 的 IBasicMap 接口!返回地图框架

ILayer:被点击的图层!返回图层
Unk:TOCControl 的 LegendGroup 对象!
Data:LegendClass 在 LegendGroup 中的 Index!
private void axTOCControl1_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e)
{
    IBasicMap map = new MapClass();
    ILayer layer = new FeatureLayerClass();
    object other = new object();
    object index = new object();
    esriTOCControlItem item = new esriTOCControlItem();
    axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref other, ref index);
    if (e.button == 1)
    {
        ILegendClass legendClass = new LegendClassClass();
        ISymbol symbol = null;
        if (other is ILegendGroup && (int)index != -1)  //判断存在性
        {
            legendClass = ((ILegendGroup)other).get_Class((int)index);  //获取 legendClass
            symbol = legendClass.Symbol;  //将自带的样式赋值给变量
        }

        symbol = GetSymbolByControl(symbol);    //函数通过窗口获取 symbol

        legendClass.Symbol = symbol;
        axMapControl1.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
    }
}
Read-only property hWnd Handle to the window associated with the TOCControl.
返回一个 int 类型的值,唯一标示此控件,每次运行的时候生成值不同!
Read/write property KeyIntercept A property that specifies interception of key strokes that are normally handled by the container. When intercepted the OnKeyDown and OnKeyUp events will be called. This value can be a combined bit mask of esriKeyIntercept enum values.
Read/write property LabelEdit Label editing state.
Read/write property LayerVisibilityEdit Layer visibility editing state.
Read/write property MouseIcon Custom mouse icon used if MousePointer is 99.
Read/write property MousePointer The mouse pointer displayed over the TOCControl.
Read-only property Object A property that returns the underlying control. This can be used when the control is inside a wrapper object that has been added by a development environment.
Method SetActiveView Sets the ActiveView used to populate the TOCControl.
Method SetBuddyControl Sets a control to be a buddy of the toolbar, this control must support ITOCBuddy.
Method Update Updates the contents of the TOCControl to match its ActiveView.

---------------------------------------------------------------------------------------------------------

●·● ILegendGroup 接口

1. Provides access to members that control the collection of legend classes provided by a renderer.

---------------------------------------------------------------------------------------------------------

●·● ILegendClass 接口

1. Provides access to members that control the legend/TOC entry for a renderer class.

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Ud个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ITOCControlEvents 接口

1. Provides access to events that occur with interaction to the TOCControl.

   This is the main events interface for the TOCControl. Generally there is no need to explicitly set event handlers, as most development environments will automatically provide event handlers.

  CoClasses that implement ITOCControlEvents

CoClasses and Classes Description
TOCControl ESRI TOCControl
TOCControlEventsListener (esriSystemUtility) Helper coclass to provide ITOCControlEvents support to the C++ API.

2. 属性和方法:

   Description
Event OnBeginLabelEdit Fires when label editing begins.
Event OnDoubleClick Fires when the user presses and releases the mouse button twice in quick succession.
Event OnEndLabelEdit Fires when label editing ends.
Event OnKeyDown Fires after a key is pressed on the keyboard.
Event OnKeyUp Fires after a pressed key is released.
Event OnMouseDown Fires when the user presses any mouse button while over the TOCControl.
Event OnMouseMove Fires when the user moves the mouse pointer over the TOCControl.
Event OnMouseUp Fires when the user releases a mouse button while over the TOCControl.

实现 ArcMap 样子的图层移动:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)  //加载地图
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "map document(*.mxd)|*.mxd";
ofd.ShowDialog();
axMapControl1.LoadMxFile(ofd.FileName,0,null);
TopMost = true;
}

ILayer moveLayer; //要移动的图层!
int mdY; //记录鼠标点击的位置中坐标!
bool isDown = false; //记录鼠标是否点击了!
int index; //记录移动到的图层的索引!

private void axTOCControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnMouseDownEvent e)  //鼠标点击
{
esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
IBasicMap map = null;
ILayer layer = null;
object Unk = null;
object Data = null;
axTOCControl1.HitTest(e.x, e.y,ref item,ref map,ref layer,ref Unk,ref Data);
moveLayer = layer; //获取要移动的图层
mdY = e.y;
panel1.Visible = true;
axTOCControl1.MousePointer = esriControlsMousePointer.esriPointerLabel;
isDown = true;
}

private void axTOCControl1_OnMouseUp(object sender, ITOCControlEvents_OnMouseUpEvent e)  //鼠标松开
{
panel1.Visible = false;
axTOCControl1.MousePointer = esriControlsMousePointer.esriPointerDefault;
isDown = false;

esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
IBasicMap map = null;
ILayer layer = null;
object Unk = null;
object Data = null;
axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref Unk, ref Data);

IMap pMap = axMapControl1.ActiveView.FocusMap;

if (moveLayer != layer) //要是不是同一图层则实行移动
{
for (int i = 0; i < pMap.LayerCount;i++ )
{
if (layer == pMap.get_Layer(i))
{
index = i; //获取移动到图层的索引
}
}
pMap.MoveLayer(moveLayer, index);
}
axTOCControl1.Refresh();
}

private void axTOCControl1_OnMouseMove(object sender, ITOCControlEvents_OnMouseMoveEvent e)  //鼠标移动
{
esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;
IBasicMap map = null;
ILayer layer = null;
object Unk = null;
object Data = null;
axTOCControl1.HitTest(e.x, e.y, ref item, ref map, ref layer, ref Unk, ref Data);
IMap pMap = axMapControl1.ActiveView.FocusMap;

if (e.y > mdY) //往下移动的时候,要插入到图层的下面
{
for (int i = 0; i < pMap.LayerCount;i++ )
{
if (layer == pMap.get_Layer(0))
panel1.Location = new System.Drawing.Point(50, 67);
else if (layer == pMap.get_Layer(1))
panel1.Location = new System.Drawing.Point(50, 103);
else if (layer == pMap.get_Layer(2))
panel1.Location = new System.Drawing.Point(50, 139);
else if (layer == pMap.get_Layer(3))
panel1.Location = new System.Drawing.Point(50, 175);
}
}
else //往上移动的时候,要插入到图层的上面
{
for (int i = 0; i < pMap.LayerCount; i++)
{
if (layer == pMap.get_Layer(0))
panel1.Location = new System.Drawing.Point(50, 31);
else if (layer == pMap.get_Layer(1))
panel1.Location = new System.Drawing.Point(50, 67);
else if (layer == pMap.get_Layer(2))
panel1.Location = new System.Drawing.Point(50, 103);
else if (layer == pMap.get_Layer(3))
panel1.Location = new System.Drawing.Point(50, 139);
}
}
if (isDown) //若处于鼠标点击状态,只有鼠标点击的时候才发生,普通状态不发生!
{
if (layer == moveLayer || (moveLayer == pMap.get_Layer(0) && e.y <= 31) || (moveLayer == pMap.get_Layer(3) && e.y >= 139))
{
axTOCControl1.MousePointer = esriControlsMousePointer.esriPointerNoDrop;
panel1.Visible = false;
}
else
{
axTOCControl1.MousePointer = esriControlsMousePointer.esriPointerLabel;
panel1.Visible = true;
}
}
}
}


---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Ue个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● IHookHelper 接口

可以实现控件之间的关联,传过去的 hook 会接收操作!

参考:http://gisfire.blog.163.com/blog/static/139077132201211942026566/

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Uf 个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● SymbologyControl 类

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Ug个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ISymbologyControl 接口

1. Provides access to members that control the SymbologyControl.

  The ISymbologyControl interface is a starting point for any tasks related to the SymbologyControl, such as setting general appearance, loading symbology from within server style files and setting the style class.

  CoClasses that implement ISymbologyControl

CoClasses and ClassesDescription
SymbologyControl Provides access to the ESRI SymbologyControl.

2. 属性和方法:

  Description
Method AboutBox Displays a dialog of information about the SymbologyControl.
Read/write property Appearance The appearance of the SymbologyControl.
Read/write property BackColor Background color of the SymbologyControl.
Read/write property BorderStyle The border style of the SymbologyControl.
Method Clear Clears all symbols and files from the SymbologyControl.
Read/write property CustomProperty A property to associate data with the SymbologyControl.
Read/write property DisplayStyle The display style of the SymbologyControl.
Read/write property Enabled Indicates whether the SymbologyControl can respond to user generated events.
Method GetStyleClass
(esriSymbologyStyleClass StyleClass)

返回值:ISymbologyStyleClass

Returns the specified style class from the SymbologyControl.

指定默认选择的符号样式!

esriSymbologyStyleClass 枚举:各种样式的集合,包括 Shadow、NorthArrow、ScaleBars 等!
string strInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path;  //获取 Engine 的安装目录
string style = strInstall + @"Styles\ESRI.ServerStyle";  //获取 ESRI 符号的文件
if (System.IO.File.Exists(style))
{
    axSymbologyControl1.LoadStyleFile(style);  //加载样式
    axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassNorthArrows;  //获取显示的符号类型  
    axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass).SelectItem(0);  //获取默认选择的符号样式 }
Method HitTest Returns the item at the specified x and y coordinates.
Read-only property hWnd Handle to the window associated with the SymbologyControl.
Read/write property KeyIntercept A property that specifies interception of key strokes that are normally handled by the container. When intercepted the OnKeyDown and OnKeyUp events will be called. This value can be a combined bit mask of esriKeyIntercept enum values.
Method LoadDesktopStyleFile Loads a desktop style file into the SymbologyControl.
加载扩展名为 .style 的文件!
Method LoadStyleFile
(string fileName)
Loads a server style file into the SymbologyControl.
加载扩展名为 .ServerStyle 的文件!
//直接插入地址调入:
axSymbologyControl1.LoadStyleFile(@"C:\Program Files (x86)\ArcGIS\Engine10.0\Styles\ESRI.ServerStyle");

//通过注册表读取:
Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\ESRI\\CoreRuntime", true);

axSymbologyControl1.LoadStyleFile(regKey.GetValue("InstallDir") + "\\Styles\\ESRI.ServerStyle");
Read/write property MouseIcon Custom mouse icon used if MousePointer is 99.
Read/write property MousePointer The mouse pointer displayed over the SymbologyControl.
Read-only property Object A property that returns the underlying control. This can be used when the control is inside a wrapper object that has been added by a development environment.
Method RemoveFile Removes a file from the SymbologyControl.
Read/write property ShowContextMenu Indicates if the SymbologyControl displays a context menu.
Read/write property StyleClass
返回值:esriSymbologyStyleClass
The style class used by the SymbologyControl.
用来获取 SymbologyControl 的符号内容!
axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassBorders;

---------------------------------------------------------------------------------------------------------

●·● ISymbologyStyleClass 接口

1. Provides access to members that control SymbologyControl style classes.

  Members

  Description
Method AddItem Adds an item to the SymbologyStyleClass.
Method GetItem Returns the item at the specified index in the SymbologyStyleClass.
Method GetSelectedItem Returns the selected item in the SymbologyStyleClass.
Read-only property ItemCount The number of items in the SymbologyStyleClass.
Method PreviewItem
(IStyleGalleryItem item, int Width, int Height)
返回值:
IPictureDisp
Previews the specified item as a bitmap.
ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass); //Preview an image of the symbol stdole.IPictureDisp picture = symbologyStyleClass.PreviewItem(m_styleGalleryItem, pictureBox1.Width, pictureBox1.Height); System.Drawing.Image image = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle)); pictureBox1.Image = image;
Method RemoveAll Removes all items from the SymbologyStyleClass.
Method RemoveItem Removes the item at the specified index from the SymbologyStyleClass.
Method SelectItem Sets the selected item in the SymbologyStyleClass.
Read/write property SortDirection The sort direction of the items in the SymbologyStyleClass.
Read/write property StyleCategory The style category used by the SymbologyStyleClass.
Read-only property StyleClass The class of the symbols in the SymbologyStyleClass.
Method UnselectItem Unsets the selected item in the SymbologyStyleClass.
Method Update Updates the contents of the SymbologyStyleClass.

---------------------------------------------------------------------------------------------------------

●·● IStyleGalleryItem 接口

 

1. Provides access to members that define items in the Style Gallery.

   Symbols and map elements are stored in the Style Gallery. Each symbol or map element has a unique ID that can be read from the item within the style gallery. A Name and Category are also properties of the items within the style gallery. These two fields, along with the Item itself, can be updated and changed as necessary.

 

  Members

 

  Description
Read/write property Category The category of the item.
Read-only property ID Id for the item in the Style Gallery.
Read/write property Item The symbol or map element to be stored in the Style Gallery item.
Read/write property Name The name of the item in the Style Gallery.

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Uh个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● ISymbologyControlEvents 接口

1. Provides access to events that occur with interaction to the SymbologyControl.

  This is the main events interface for the SymbologyControl. Generally there is no need to explicitly set event handlers, as most development environments will automatically provide event handlers.

2. 属性和方法:

  Description
Event OnDoubleClick Fires when the user presses and releases the mouse button twice in quick succession.
Event OnItemSelected Fires when an item is selected in the SymbologyControl.
当选中某个选项的时候触发事件!
e.styleGalleryItem  获取选项的样式
IStyleGalleryItem styleGalleryItem = (IStyleGalleryItem)e.styleGalleryItem;
Event OnKeyDown Fires after a key is pressed on the keyboard.
Event OnKeyUp Fires after a pressed key is released.
Event OnMouseDown Fires when the user presses any mouse button while over the SymbologyControl.
Event OnMouseMove Fires when the user moves the mouse pointer over the SymbologyControl.
Event OnMouseUp Fires when the user releases a mouse button while over the SymbologyControl.
Event OnStyleClassChanged Fires when the style class changes.

 

--------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Ui 个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● GlobeControl 类

1. GlobeControl 是一个高性能的嵌入式的开发组件,提供给开发者建立和扩展ArcGlobe 程序,当然也提供了基于ArcGlobe TM 的功能给用户,以便进行绘图等操作。GlobeControl 显示3D 视图,并能提供全球表现的位置,而且是基于3D数据。GlobeControl 控件对应于ArcGlobe 桌面应用程序的三维视图。GlobeControl 封装了G10beViewer 对象, 可以加载ArcGlobe 应用程序创作的Globe文挡。

  GlobeControl 也是单一的开发进程, 并且提供了粗粒度ArcEngine 组件对象,当然也提供了强大纹理着色的ArcEngine 组件。GlobeControl 通过对象接口来操作IGlobe 视图,用户可以通过IGlobeViewer 对象来操作ArcGlobe 应用程序。IGlobeViewer 接象包含一个GlobeDisplay,GlobeDisplay 又包含一个Globe。GlobeControl 提供了经常使用的属性和方法, 例如,GlobeControl 有 GlobeCamera 、Globe 、GlobeDisplay 和 GlobeViewer 等属性, 当然GlobeControl 也能执行一些方法或任务,例如, GlobeControl 有Load3dFile 方法用于导人globe 文档。GlobeControl 是进行三维开发最基本的控件,因为其提供了用户界面,所以更容易进行开发,当然使用对象模型也能很容易地理解及开发三维功能。

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Uj 个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● SceneControl 类

1. SceneControl 是一个高性能的嵌入式的开发组件,提供给开发者建立和扩展Scene 程序,当然也提供了基于ArcScene的功能给用户,以便进行绘图等操作。控件SceneControl 相当于ArcScene Desktop 应用程序中的3D视图, 并且提供了显示和增加空间数据到3D 的方法等。
  SceneControl 是单一的开发进程,并且提供了粗粒度ArcEngine 组件对象,也提供了强大纹理着色的功能。SceneControl 通过对象接口ISceneViewer 来表现。ISceneViewer 接口提供了一个Camera 对象, 该对象囱视角( Observer ) 和目标( Target ) 构成。SceneControl 控件提供一些属性和方法镰作三维对象。例如. Camera 、Scene 、SceneGraph 和SceneViewer 等属性。LoadSxFile方法, 用于导人sωne 文挡。SceneControl 是进行三维开发最基本的控件。

 

 

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗
╠════╣    第Uk个    ╠══════════════════════════════════════════════════╣
            ╚════════╝

●·● esriControlsMousePointer 类

1.

 

 

 

 

esriTOCControlItem

posted on 2012-03-14 21:46  McDelfino  阅读(6897)  评论(0编辑  收藏  举报