I know it should be pretty easy to achieve. I am just starting to learn VB.NET.

I need help creating an outline around a custom shape picturebox.

I also need to specify the color and thickness of this outline. The path is on variable gp... but I can't figure how to redraw this on top and not inside the canvas to give it the appearance of a border.

Here is my code:

' Define canvas shape....... 
        Dim r As New Rectangle(0, 0, picCanvas.Width, picCanvas.Height)
        Dim d As Integer = 30
        Dim gp As New Drawing2D.GraphicsPath()
        'Dim g As Graphics = Me.CreateGraphics()

        gp.AddArc(r.X, r.Y, d, d, 180, 90)
        gp.AddArc(r.X + r.Width - d, r.Y, d, d, 270, 90)
        gp.AddArc(r.X + r.Width - d, r.Y + r.Height - d, d, d, 0, 90)
        gp.AddArc(r.X, r.Y + r.Height - d, d, d, 90, 90)
        picCanvas.Region = New Region(gp)


Any help will be trully appreciated.

Thanks in advance.

7 Years
Discussion Span
Last Post by ecedano

Use gp.PathPoints and graphics.DrawLines methods.

Thanks. I forgot to mention I am a rookie. Can you give me a code sample?



Have you googled it? http://www.google.com

Yes I did. But all the references that I found are starting a drawing from scratch.

On the code.. I understand that the drawing was assigned to a variable called gp. Then later the picturebox region was defined with it. But I do not know how to write a line statement to say "draw the content of the variable gp with a thickenss of x on x,y location". Here is where I need some help. I have tryed many things and nothing seems to do the trick.



Please refere these two links. I hope this will solved your problem.

Thanks for your reply and information.

Maybe I explained something wrong. I already shaped the picturebox and it looks fine. But I can't put a border arround it.

I have tryed several ways and either its a really thin line arround missing some areas or is not showing at all.

The help I need is on how to outline a custom shape picturebox.



Thanks ecedano,
If your problem get solved then mark this thread as "Solved".

Let me refrase this... I need help creating a border line around a custom picturebox shape. (I already have the picturebox custom shape in place)

When I create the custom-picturebox... I do not know how to apply a border at all. I am clueless.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.