Add border around (picture) rectangle

In our project we create a rectangle shaped picture using Graphics.FillRect.
The picture is shown on a BevelButton at MouseEnter.

The rectangle is created (p1 is defined as Picture Property):

p1 = New picture(BevelButton1.Width ,BevelButton1.Height, 32)
p1.Graphics.ForeColor = &cACAED7FF
p1.Graphics.FillRect(0, 0, BevelButton1.Width, BevelButton1.Height)

On MouseEnter

If Me.Enabled Then Me.Icon = p1

We would like to create a border around this rectangle with a different color (&cAFAFAFFF)
Using:

p1.Graphics.ForeColor = &cAFAFAFFF p1.Graphics.DrawRect(0, 0, BevelButton1.Width, BevelButton1.Height)
overwrites the previous created Graphics.FillRect, which is obvious.

Is it possible to create a border around the created rectangle, if so how can this be done?

You’re drawing with 100% transparency. How does that code even produce a visible image?

Transparency aside, I cannot reproduce your problem. DrawRect does not affect the pixels inside the rectangle, only the border.

I totally forgot about the transparency.
:blush:

After I changed &cAFAFAFFF to &cAFAFAF00 the border was visible.
Thank you Tim, for pointing out transparency.