ahshegis
路人甲
路人甲
  • 注册日期2004-10-22
  • 发帖数181
  • QQ
  • 铜币847枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1319回复:1

我用以下这种方式添加图形,哪错了??

楼主#
更多 发布于:2005-09-23 21:12
<P>VB+AO中,我用以下这种方式添加图形,应该怎么加?我想添加一个带斜线的矩形框.</P>
<P>Private Sub Command1_Click()</P>
<P>  Dim pGraphicsContainer As IGraphicsContainer<BR>  Set pGraphicsContainer = PageLayoutControl1.PageLayout<BR>  <BR>  Dim pEnv As IEnvelope<BR>  Set pEnv = New Envelope<BR>  pEnv.PutCoords 10, 10, 50, 50<BR>  Dim pE As IElement<BR>  'Dim pR As IRectangleElement<BR>  Set pE = New RectangleElement<BR>   pE.Geometry = pEnv<BR>  pGraphicsContainer.AddElement pE, 0<BR>  <BR>  PageLayoutControl1.ActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing<BR>End Sub</P>
<img src="images/post/smile/dvbbs/em12.gif" />
喜欢0 评分0
kisssy
卧底
卧底
  • 注册日期2004-04-18
  • 发帖数235
  • QQ
  • 铜币614枚
  • 威望2点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-09-23 22:14
<P>Private Sub Command1_Click()</P>
<P><BR>  Dim pGraphicsContainer As IGraphicsContainer<BR>  Set pGraphicsContainer = PageLayoutControl1.PageLayout<BR>  <BR>  Dim pEnv As IEnvelope<BR>  Set pEnv = New Envelope<BR>  pEnv.PutCoords 10, 10, 50, 50<BR>  Dim pE As IElement<BR>  'Dim pR As IRectangleElement<BR>  Set pE = New RectangleElement<BR>  <BR>  'Get the IRGBColor interface<BR>  Dim pColor As IRgbColor<BR>  Set pColor = New RgbColor<BR>  'Set the color properties<BR>  pColor.RGB = RGB(255, 0, 0)<BR>  pColor.Transparency = 255</P>
<P>  'Get the ILine symbol interface<BR>  Dim pOutline As ILineSymbol<BR>  Set pOutline = New SimpleLineSymbol<BR>  'Set the line symbol properties<BR>  pOutline.Width = 10<BR>  pOutline.Color = pColor</P>
<P>  'Create the LineFillSymbol<BR>  Dim pLineFill As ILineFillSymbol<BR>  Set pLineFill = New LineFillSymbol<BR>  With pLineFill<BR>  .Angle = 45<BR>  .Separation = 10<BR>  .Offset = 5<BR>  End With<BR>  Set pLineFill.LineSymbol = pOutline<BR>  <BR>  Dim pFillShapeElement As IFillShapeElement<BR>  Set pFillShapeElement = pE<BR>  'Set the symbol property<BR>  pFillShapeElement.Symbol = pLineFill</P>
<P>   pE.Geometry = pEnv<BR>  pGraphicsContainer.AddElement pE, 0<BR>  <BR>  PageLayoutControl1.ActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing</P>
<P><BR>End Sub<BR></P>
个人专栏: https://zhuanlan.zhihu.com/c_165676639
举报 回复(0) 喜欢(0)     评分
游客

返回顶部