sulin
路人甲
路人甲
  • 注册日期2003-07-28
  • 发帖数158
  • QQ
  • 铜币501枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2511回复:4

ArcEngine怪问题

楼主#
更多 发布于:2006-09-07 16:15
<P>各位大侠,有没有碰见这种情况,ILegendItem不管怎么设置其标注属性,就是不起作用,也就是我不管怎么LabelSymbol的字体、大小、颜色设置,就是不起作用,画出来的字体一样都是黑色的,大小也一样。下面是关键代码,请帮我找错。</P>
<P> //clear the all legenditems<BR> ipLegend->ClearItems();</P>
<P> for(long i=0; i<strLayername.size(); i++)<BR> {<BR>  //get the layer across the layer name layername<BR>  CString layername = strLayername.at(i);<BR>  ILayerPtr ipLayer;<BR>  if (FAILED (hr = GetLayerFromName(ipmap, layername, ipLayer))) return E_FAIL;</P>
<P>  //add the legenditem<BR>  ILegendItemPtr ipLegendItem(CLSID_HorizontalLegendItem);  <BR>  if (FAILED (hr = ipLegendItem->putref_Layer(ipLayer))) return E_FAIL;</P>
<P>  ITextSymbolPtr ipTextSymbol; <BR>  //set the head text<BR>  if (ipHeadTS == NULL)<BR>  {<BR>   if (FAILED (hr = ipLegendItem->get_HeadingSymbol(;ipTextSymbol))) return E_FAIL;<BR>   ipTextSymbol->put_Size(14.0);<BR>   if (FAILED (hr = ipLegendItem->put_HeadingSymbol(ipTextSymbol))) return E_FAIL;<BR>  }<BR>  else<BR>  {<BR>   if (FAILED (hr = ipLegendItem->put_HeadingSymbol(ipHeadTS))) return E_FAIL;<BR>  }<BR>  <BR>  //set the width and height of the patch<BR>  ILegendClassFormatPtr ipLegendCF;<BR>  if (FAILED (hr = ipLegendItem->get_LegendClassFormat(;ipLegendCF))) return E_FAIL;<BR>  <BR>  if (FAILED (hr = ipLegendCF->put_PatchWidth(width))) return E_FAIL;<BR>  if (FAILED (hr = ipLegendCF->put_PatchHeight(height))) return E_FAIL;</P>
<P>  //set the label text<BR>  if (ipLabelTS == NULL)<BR>  {<BR>   if (FAILED (hr = ipLegendCF->get_LabelSymbol(;ipTextSymbol))) return E_FAIL;<BR>   ipTextSymbol->put_Size(12.0);<BR>   if (FAILED (hr = ipLegendCF->put_LabelSymbol(ipTextSymbol))) return E_FAIL;<BR>  }<BR>  else<BR>  {<BR>   if (FAILED (hr = ipLegendCF->put_LabelSymbol(ipLabelTS))) return E_FAIL;<BR>  }<BR>  double fONTSIZE;<BR>  ipLabelTS->get_Size(;fONTSIZE);</P>
<P>  ipLegendItem->put_LegendClassFormat(ipLegendCF);</P>
<P>  if (FAILED (hr = ipLegend->AddItem(ipLegendItem))) return E_FAIL;<BR> }</P>
<P> ipLegend->Refresh();</P><img src="images/post/smile/dvbbs/em30.gif" />
喜欢0 评分0
hsghxm
路人甲
路人甲
  • 注册日期2004-10-27
  • 发帖数517
  • QQ4604052
  • 铜币1枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-09-07 16:23
<P>ILegendItemPtr 的<a href="mk:@MSITStore:C:\Program%20Files\ArcGIS\DeveloperKit\Help\COM\VB\esriCarto.chm::/ILegendItem_Width.htm" target="_blank" ><STRONG>Width</STRONG></A>和<a href="mk:@MSITStore:C:\Program%20Files\ArcGIS\DeveloperKit\Help\COM\VB\esriCarto.chm::/ILegendItem_Height.htm" target="_blank" ><STRONG>Height</STRONG></A>移动要设置,它的大小直接影响到整体的字体大小,只要这个设置合适后,SYMBOL的字体大小是否设置都没关系</P>
MSN:hsghxm@163.com QQ:4604052 (很少用,最好别加) Email:hsghxm@163.com 我的BOLG:http://www.gisempire.com/blog/user1/864/index.htm
举报 回复(0) 喜欢(0)     评分
sulin
路人甲
路人甲
  • 注册日期2003-07-28
  • 发帖数158
  • QQ
  • 铜币501枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-09-07 17:20
<P>最关键的是我要改变字体的颜色,我设置Legend TitleSymbol是成功的,但就是ILegendItemPtr不管用,还请大侠多多指点。</P>
<P>谢谢你的回答!</P>
举报 回复(0) 喜欢(0)     评分
sulin
路人甲
路人甲
  • 注册日期2003-07-28
  • 发帖数158
  • QQ
  • 铜币501枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-09-19 10:31
<P>郁闷!没有人再回答.</P><img src="images/post/smile/dvbbs/em15.gif" />
举报 回复(0) 喜欢(0)     评分
hsghxm
路人甲
路人甲
  • 注册日期2004-10-27
  • 发帖数517
  • QQ4604052
  • 铜币1枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2006-09-19 12:26
楼主搞深下去了,帮顶一下<img src="images/post/smile/dvbbs/em01.gif" />
MSN:hsghxm@163.com QQ:4604052 (很少用,最好别加) Email:hsghxm@163.com 我的BOLG:http://www.gisempire.com/blog/user1/864/index.htm
举报 回复(0) 喜欢(0)     评分
游客

返回顶部