IElement pele = new MarkerElementClass();
IPoint pp = new PointClass();
pp.PutCoords(e.mapX, e.mapY);
pele.Geometry = pp;
IMarkerElement pme = pele as IMarkerElement;
IRgbColor prgb = new RgbColorClass();
prgb.Blue = cc.B;
prgb.Green = cc.G;
prgb.Red = cc.R;
psms.Color = prgb;
pme.Symbol = psms;
pgc.AddElement(pele, 0);
this.axMapControl1.ActiveView.Refresh();
//写入数据库
string scn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=数据表.mdb";
OleDbConnection mycn = new OleDbConnection(scn);
mycn.Open();
OleDbCommand mycmd = new OleDbCommand();
mycmd.Connection = mycn;
mycmd.CommandType = CommandType.Text;
mycmd.CommandText = "select * from point1";
OleDbDataAdapter adap = new OleDbDataAdapter();
adap.SelectCommand = mycmd;
DataSet ds = new DataSet();
adap.Fill(ds, "a");
DataTable dt = new DataTable();
dt = ds.Tables["a"];
string s = DateTime.Now.ToString();
int indext = this.comboBox1.SelectedIndex + 1;
string id = indext.ToString();
int x = Convert.ToInt32(pp.X);
string d = "insert into point1 values('" + id + "'," + x + "," + pp.Y + ",'" + s + "')";
mycmd.CommandText = d;
mycmd.ExecuteNonQuery();
this.dataGridView1.DataSource = ds.Tables[0];