C#MapX添加圖元

                            MapXLib.Point pnt = new MapXLib.Point();
                            MapXLib.Style newStyle = new MapXLib.Style();
                            lyr = axMap1.Layers.Item("¹Ç¸É¾ÖÕ¾");
                            //MapXLib.FeatureFactory feafac = axMap1.FeatureFactory;
                            ft = axMap1.FeatureFactory ;
                            newStyle.SymbolType = 1;//MapXLib.SymbolTypeConstants.miSymbolTypeBitmap;
                            newStyle.SymbolBitmapSize = 20;
                            newStyle.SymbolBitmapTransparent = true;
                            newStyle.SymbolBitmapName = "1_r1_c3.BMP";

                         
                            axMap1.AutoRedraw = false;
                            lyr.Editable = true;
                            
                            pnt.Set(e.x1, e.y1);
                           
                            MapXLib.Feature ftr = ft.CreateSymbol(pnt, newStyle);
                           
                            lyr.AddFeature(ftr, new MapXLib.RowValues());
                            lyr.Refresh();
                            //pnt = null;
                            //feafac = null;
                            //lyr = null;
                            //ftr = null;             




                            //all this draw text. this is rithgt .
                            MapXLib.Feature ftr1 = new MapXLib.FeatureClass();

                            MapXLib.Point p = new MapXLib.PointClass();
                            //p.Set(axMap1.CenterX, axMap1.CenterY);
                            //pt.Set(pnt.X + 5.0, pnt.Y + 5.0);
                         ftr1 = axMap1.Layers.Item("骨幹局站").AddFeature(axMap1.FeatureFactory.CreateText
                             (pt, "     New Feature", MapXLib.PositionConstants.miPositionCC,
                             new MapXLib.StyleClass()),
                             new MapXLib.RowValuesClass());


                            ft = axMap1.FeatureFactory.IntersectFeatures(ftr, ftr1);
                //though here is component two icon into one ,but  need add Feature.
               axMap1.Layers.Item("骨幹局站").AddFeature(ft,new MapXLib.RowValuesClass());
                axMap1.AutoRedraw = true;
                            lyr.Editable = false;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章