Hi,

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.

Use gp.PathPoints and graphics.DrawLines methods.

Use gp.PathPoints and graphics.DrawLines methods.

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

Regards.

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.

Regards.

Please refere these two links. I hope this will solved your problem.
http://msdn.microsoft.com/en-us/library/aa289517(VS.71).aspx
http://www.neowin.net/forum/lofiversion/index.php/t143418.html

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.

Regards

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.