阅读:1138回复:0
[求助]增加图元时,出现了图层不可编辑的错误?
<P>我刚刚开始学习mapX大家指导一下吧</P>
<P>procedure TForm1.Map1ToolUsed(ASender: TObject; ToolNum: Smallint; X1, Y1,<BR> X2, Y2, Distance: Double; Shift, Ctrl: WordBool;<BR> var EnableDefault: WordBool);<BR>var<BR> pt:CMapXPoint;<BR> Lyr:CMapXLayer;<BR> ftr:CMapXFeature;<BR> feaFac:CMapXFeatureFactory;<BR> newStyle:CMapXStyle;<BR>begin<BR> //邦定<BR> lyr:=Map1.Layers['China Major cities'];<BR> feaFac:=map1.FeatureFactory;<BR> //设置点对象样式<BR> newstyle:=CoStyle.Create;<BR> newstyle.SymbolType:=miSymbolTypeBitmap;<BR> newstyle.SymbolBitmapSize:=24;<BR> newstyle.SymbolBitmapTransparent:=false;<BR> newstyle.SymbolBitmapName:='YIEL2-32.BMP';<BR> //禁止自动刷新<BR> Map1.AutoRedraw:=false;<BR> //置当前图层为可写状态<BR> lyr.Editable:=true;<BR> //创建点对象<BR> pt:=CoPoint.Create;<BR> pt.Set_(map1.CenterX,map1.CenterY);<BR> //添加进当前图层<BR> ftr:=feafac.CreateSymbol(pt,NewStyle); //创建符号<BR> ftr:=feafac.CreateSymbol(pt,map1.DefaultStyle);<BR> //添加<BR> lyr.AddFeature(ftr,EmptyParam);<BR> lyr.Refresh;<BR> map1.AutoRedraw:=true;<BR> lyr.Editable:=false;<BR> //释放<BR> pt._Release;<BR> newStyle._Release;<BR>end;</P> |
|