vb.net arcobjects create transparent buffer

2719
4
Jump to solution
09-07-2014 07:14 PM
Highlighted
by
New Contributor III

Hi all,

I want to check when a create a buffer on arcmap, how can I make the buffer transparent? I am using vb.net arcobjects.

Any advice will be appreciated.

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor

Actually you can get something that is pretty close to transparency on the ISymbol interface.  So let's say you have created a  graphic element (a IFillShapeElement could be a polygon or a rectangle as shown below).  You will then find the  the  ISymbol:ROP2 and by setting it equal to esriROPMaskPen, it makes for a nice semi-transparent fill.

    Dim fillShapeEl As IFillShapeElement

    Set fillShapeEl = rect

    Dim sfs As ISimpleFillSymbol

    Set sfs = New SimpleFillSymbol

    Dim rgb As IRgbColor

    Set rgb = New RgbColor

    rgb.Red = 255

    'rgb.Transparency = 50 'This doesn't behave as expected...still 100% opaque

    Dim sym As ISymbol

    Set sym = sfs

    sym.ROP2 = esriROPMaskPen 'This is the magic line!!

    sfs.Color = rgb

    fillShapeEl.Symbol = sfs

    gc.AddElement rect, 0

SemiTransparent.png

View solution in original post

4 Replies
Highlighted
MVP Frequent Contributor

Li,

Assuming your buffer exists in a layer and is not just some polygon then you can use the interface ILayerEffects to alter the transparency. Only layers support transparency, so if you were intending to create a polygon buffer and display it as a graphic then that will not work.

Duncan

Highlighted
by
New Contributor III

Hi Duncan,

Thanks for the reply. I have already create a transparent buffer (for polygon), but now I am unable to remove the colour of the boundary of the buffer.

Reply
0 Kudos
Highlighted
Occasional Contributor

Actually you can get something that is pretty close to transparency on the ISymbol interface.  So let's say you have created a  graphic element (a IFillShapeElement could be a polygon or a rectangle as shown below).  You will then find the  the  ISymbol:ROP2 and by setting it equal to esriROPMaskPen, it makes for a nice semi-transparent fill.

    Dim fillShapeEl As IFillShapeElement

    Set fillShapeEl = rect

    Dim sfs As ISimpleFillSymbol

    Set sfs = New SimpleFillSymbol

    Dim rgb As IRgbColor

    Set rgb = New RgbColor

    rgb.Red = 255

    'rgb.Transparency = 50 'This doesn't behave as expected...still 100% opaque

    Dim sym As ISymbol

    Set sym = sfs

    sym.ROP2 = esriROPMaskPen 'This is the magic line!!

    sfs.Color = rgb

    fillShapeEl.Symbol = sfs

    gc.AddElement rect, 0

SemiTransparent.png

View solution in original post

Highlighted
by
New Contributor III

Hi Duncan & Taig,

I have already resolved the issue, thanks a lot for the attention and help.

Reply
0 Kudos