阅读:1443回复:1
我用以下这种方式添加图形,哪错了??
<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" /> |
|
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> |
|
|