tr = tc.ExecuteReader() ;
//MIDataReader.Read 如果有多个行则返回 true,否则返回 false
int i=0;
while (tr.Read())
{
//获得指定字段的字符串值
listView1.Items.Add(tr.GetString(1));
}
//Cancel 尝试取消当前命令的执行
tc.Cancel();
//Dispose 处置 MICommand 对象
tc.Dispose();
//tr.Close关闭数据读取器并释放资源,con.Close关闭连接
tr.Close() ;
con.Close();
//t.Close();
10、问:如何在桌面应用中对地图赋予指定的工具?
答:代码如下:
mapControl1.Tools.LeftButtonTool = "pan";
MapToolButtonType 枚举:指定 MapToolBarButton 的按钮类型。
成员名 说明
OpenTable 调用 LoadMapWizard。该按钮是推入型按钮。
LayerControl 调用 LayerControlDlg。该按钮是推入型按钮。
Arrow 设置 Arrow 工具。
ZoomIn 设置 ZoomIn 工具。mapxtreme
ZoomOut 设置 ZoomOut 工具。
Center 设置 Center 工具。
Pan 设置 Pan 工具。
Select 设置 Select 工具。
SelectRectangle 设置 SelectRectangle 工具。
SelectRadius 设置 SelectRadius 工具。
SelectPolygon 设置 SelectPolygon 工具。
SelectRegion 设置 SelectRegion 工具。
Label 设置 Label 工具。
AddText 设置 AddText 工具。
AddPoint 设置 AddPoint 工具。
AddLine 设置 AddLine 工具。
AddPolyline 设置 AddPolyline 工具。
AddPolygon 设置 AddPolygon 工具。
AddRectangle 设置 AddRectangle 工具。
AddCircle 设置 AddCircle 工具。
AddEllipse 设置 AddEllipse 工具。
11、问:如何获取地图上指定的一个表中所选择到的图元的信息(包括经纬度值)?
答:代码如下:
FeatureLayer lyr=mapControl1.Map.Layers["DIJISHI"] as FeatureLayer ;
IResultSetFeatureCollection irfc = Session.Current.Selections.DefaultSelection[lyr.Table ];
foreach(MapInfo.Data.Feature l in irfc )
{
foreach(MapInfo.Data.Column column in l.Columns)
{
//print out the column name and contents with the following:
MessageBox.Show (string.Format("{0}:{1}",column.ToString().ToUpper(),l[column.ToString()].ToString()));
}
MessageBox.Show("经度:" + l.Geometry.Centroid.x.ToString() + ",纬度:" + l.Geometry.Centroid.y.ToString());
}
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-36378-6.html
说白了预调酒只有新鲜度