mally
路人甲
路人甲
  • 注册日期2005-11-21
  • 发帖数8
  • QQ
  • 铜币144枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1741回复:0

[求助]为什么我的动态修改文本图元字体大小的代码不能实现?

楼主#
更多 发布于:2006-10-02 15:19
<P>大家帮我看看,我要动态修改图层里的文本图元的字体大小,但是没有达到目标。代码如下:</P>
<P>procedure SetFontSize(lyname: string; fsize: integer);<BR>var<BR>  ly : layer;<BR>  i : integer;<BR>  tmpFont : variant;<BR>  myfont : TFont;<BR>begin<BR>  myfont := TFont.Create;<BR>  try<BR>    ly := Map1.Layers.Item[lyname];<BR>    if ly <> nil then<BR>    begin<BR>      for i := 1 to ly.AllFeatures.Count do<BR>      begin<BR>        if ly.AllFeatures.Item.type_=5 then  //文本图元<BR>        begin<BR>          tmpFont := ly.AllFeatures.Item.Style.TextFont;<BR>          olefonttofont(tmpFont,myFont);<BR>          myfont.size := 6;<BR>          tmpFont := fonttoolefont(myfont);<BR>          ly.AllFeatures.Item.Update(true,emptyParam);<BR>        end;<BR>      end;<BR>    end;<BR>  finally<BR>    myfont.Free;<BR>    myfont := nil;<BR>  end;<BR>end;</P>
喜欢0 评分0
游客

返回顶部