private void btnPointSave_Click(object sender, EventArgs e)
{
string strResult = null;
string strPoiName = txtPoiName.Text;//名称
string strLongitude = txtJD.Text; //经度
string strLatitude = txtWD.Text; //纬度
string strCity = ComboCity.Text; //所属城市
string strMinScale = cmbMin.Text; //最小显示级别
string strMaxScale = cmbMax.Text; //最大显示级别
string strFontName = ComboFont.Text; //宋体
string strFontSize = ComboFontSize.Text ; //字体大小
string strFrontColor = m_Color.ToString();//字体颜色
string strBmpFileName = "3.bmp"; //标记图标所属的文件名
string strBmpIndex = txtBMPindex.Text; //在图标文件里的索引
string strObjectID = txtInfo.Text; //气泡里显示的文字
string strID = "";
int nID = 0;
if( m_PointADDorEDITtype == 1)
{//增加新标注
m_PointAddID++;
nID = m_PointAddID;
strID = nID.ToString();
strResult = strResult + strID + "," + strPoiName + "," + strCity + "," + strFontName + "," + strFontSize + ","
+ strFrontColor + "," + strMinScale + "," + strMaxScale + "," + strBmpFileName + "," + strBmpIndex + ","
+ strLongitude + "," + strLatitude + "," + strObjectID + "," + ";";
}
else if(m_PointADDorEDITtype == 2)
{//修改标注
nID = m_PointEditID;
strID = nID.ToString();
strResult = strResult + strID + "," + strPoiName + "," + strCity + "," + strFontName + "," + strFontSize + ","
+ strFrontColor + "," + strMinScale + "," + strMaxScale + "," + strBmpFileName + "," + strBmpIndex + ","
+ strLongitude + "," + strLatitude + "," + strObjectID + "," + ";";
}
//‘‘标准的‘‘{"116,lim,青岛市,宋体,12,0,0,500,2.bmp,4,41896957,13454163,,;"}
MyMap1.AddMyPoi(nID, strResult);
MyMap1.DrawMap();
}
在标注点的单击触发事件OnSelectPoi函数里处理自己想要做的事情(例如单击后弹出一个窗体,显示该标注点的一些信息)
private void MyMap1_OnSelectPoi(object sender, AxMYMAPLib._DMyMapEvents_OnSelectPoiEvent e)
{
int nID = e.nID;
if(!m_bEditPointState)
{
FrmPic form = new FrmPic(nID);
form.ShowDialog();
MyMap1.SetMapOperateMode(40);// ‘‘‘运动状态
}
}
另外,还有添加道路、透明圆形、透明多边形、透明矩形、箭头等函数, 第一次发表文章,先写这么多吧,留着以后再整理。