阅读:2131回复:3
[求助]ArcEngine 元素转换为要素
ArcEngine 元素转换为要素?用到什么接口啊,谢谢
[此贴子已经被作者于2007-12-18 13:59:57编辑过]
|
|
1楼#
发布于:2007-12-18 14:31
<DIV right" align=right></DIV>IPictureElement如何保存详见代码<BR><BR>
<DIV>Dim pMxDoc As IMxDocument <BR> Set pMxDoc = ThisDocument <BR> <BR> Dim pPictureElement As IPictureElement <BR> ' why doesn't the following line work ... <BR> 'Set pPictureElement = new esriCore.JpgPictureelement <BR> <BR> ' while this one does ? <BR> Set pPictureElement = CreateObject("esriCore.JpgPictureelement") <BR> pPictureElement.ImportPictureFromFile "D:\arcgis\sampledata\untitled.jpg" <BR> <BR> Dim pEnv As IEnvelope <BR> Set pEnv = New Envelope <BR> pEnv.PutCoords 1, 1, 5, 5 <BR> <BR> Dim pElement As IElement <BR> Set pElement = pPictureElement <BR> pElement.Geometry = pEnv <BR> <BR> Dim pGC As IGraphicsContainer <BR> Set pGC = pMxDoc.PageLayout <BR> <BR> pGC.AddElement pElement, 0 <BR> Dim pAV As IActiveView <BR> Set pAV = pGC <BR> pAV.PartialRefresh esriViewGraphics, pElement, pEnv</DIV> |
|
2楼#
发布于:2007-12-18 18:36
<P>对啊 我正好也碰到这个问题!!!!!</P>
<P>AE9.2+C# 开发交流群:9034740 进来大家一起交流下</P> |
|
3楼#
发布于:2007-12-20 11:02
<DIV class=t_msgfont>解决方法:</DIV>
<DIV class=t_msgfont> </DIV> <DIV class=t_msgfont><FONT color=#0000ff>IElementCollection pElementCol = new ElementCollectionClass();<BR> pElementCol.Add(element, 0);<BR> IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)((IDataset)pFeatureLayer).Workspace;<BR> pWorkspaceEdit.StartEditOperation();<BR> IFeature pFeature = pFeatureLayer.FeatureClass.CreateFeature();<BR> IAnnotationFeature pAnnoFeature = (IAnnotationFeature)pFeature;<BR> pAnnoFeature.Annotation = element;<BR> pFeature.Store();<BR> pWorkspaceEdit.StopEditOperation();</FONT></DIV> <DIV class=t_msgfont><FONT color=#0000ff></FONT></DIV> <DIV class=t_msgfont><FONT color=#ff0000> <DIV>保存MXD文档,可以保存Element或者转换成Feature存在Featurelayer中</DIV> <DIV class=t_msgfont>为什么老是报<FONT color=#0000ff>pAnnoFeature值为空啊 </FONT></DIV></FONT></DIV><!-- BlogbotContentEnd --> |
|