Home All Groups Group Topic Archive Search About

Insert Border around a picture

Author
1 Apr 2005 4:43 PM
Aris
I wonder if there is an easy way to plase a border around a picture.

I have already tryed with the trasparent function but the border gets upon
the picture so it hides some of it.

I have created borders with white space in the middle and with the
bmp_Frame.MakeTransparent(Color.White)

and
Dim pointToDraw As New RectangleF(0, 0, PictureBox1.Width, PictureBox1.Height)

gr.DrawImage(bmp_Frame, pointToDraw)

I create a new picture having on top the border.

What I want is to place it around.

regards

Aris Lazaridis

Author
1 Apr 2005 6:35 PM
Shane Story
So what is happening when you create the new bitmap?

Seems you would create a new bitmap, bigger than the original, according to
border width, offset the top left corner accordingly, drawimage from
original to new one and then save/display it.

What's happening?

shane
Show quoteHide quote
"Aris" <A***@discussions.microsoft.com> wrote in message
news:9DF9FCA2-C2B8-4184-8F3B-978809BE0D40@microsoft.com...
>I wonder if there is an easy way to plase a border around a picture.
>
> I have already tryed with the trasparent function but the border gets upon
> the picture so it hides some of it.
>
> I have created borders with white space in the middle and with the
> bmp_Frame.MakeTransparent(Color.White)
>
> and
> Dim pointToDraw As New RectangleF(0, 0, PictureBox1.Width,
> PictureBox1.Height)
>
> gr.DrawImage(bmp_Frame, pointToDraw)
>
> I create a new picture having on top the border.
>
> What I want is to place it around.
>
> regards
>
> Aris Lazaridis
>
>
>
Author
3 Apr 2005 8:39 PM
Aris
Thanks for your time but..

I dont know exactly what will be the border thikness.
I want to calculate somehow the inner white space or some other color to
create inside of it the new image (picture)

Regards
Aris


Show quoteHide quote
"Shane Story" wrote:

> So what is happening when you create the new bitmap?
>
> Seems you would create a new bitmap, bigger than the original, according to
> border width, offset the top left corner accordingly, drawimage from
> original to new one and then save/display it.
>
> What's happening?
>
> shane
> "Aris" <A***@discussions.microsoft.com> wrote in message
> news:9DF9FCA2-C2B8-4184-8F3B-978809BE0D40@microsoft.com...
> >I wonder if there is an easy way to plase a border around a picture.
> >
> > I have already tryed with the trasparent function but the border gets upon
> > the picture so it hides some of it.
> >
> > I have created borders with white space in the middle and with the
> > bmp_Frame.MakeTransparent(Color.White)
> >
> > and
> > Dim pointToDraw As New RectangleF(0, 0, PictureBox1.Width,
> > PictureBox1.Height)
> >
> > gr.DrawImage(bmp_Frame, pointToDraw)
> >
> > I create a new picture having on top the border.
> >
> > What I want is to place it around.
> >
> > regards
> >
> > Aris Lazaridis
> >
> >
> >
>
>
>
Author
1 Apr 2005 9:41 PM
Herfried K. Wagner [MVP]
"Aris" <A***@discussions.microsoft.com> schrieb:
>I wonder if there is an easy way to plase a border around a picture.

\\\
Dim b As Image = Bitmap.FromFile("C:\WINDOWS\Angler.bmp")
Me.PictureBox1.Image = CreateFramedImage(b, Color.Yellow, 2)
b.Dispose()
..
..
..
Private Function CreateFramedImage( _
    ByVal Source As Image, _
    ByVal BorderColor As Color, _
    ByVal BorderThickness As Integer _
) As Image
    Dim b As New Bitmap( _
        Source.Width + BorderThickness * 2, _
        Source.Height + BorderThickness * 2 _
    )
    Dim g As Graphics = Graphics.FromImage(b)
    g.Clear(BorderColor)
    g.DrawImage(Source, BorderThickness, BorderThickness)
    g.Dispose()
    Return b
End Function
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
3 Apr 2005 8:35 PM
Aris
Thanks for your answer but I know this much.
What I need is to figure out the dimentions of the inner white space of each
border  ... if it is possible ?

You see I want to have predifined images as borders with drawings to put
around the pictures.

Thanks in advance
and thanks again for your tip.


Show quoteHide quote
"Herfried K. Wagner [MVP]" wrote:

> "Aris" <A***@discussions.microsoft.com> schrieb:
> >I wonder if there is an easy way to plase a border around a picture.
>
> \\\
> Dim b As Image = Bitmap.FromFile("C:\WINDOWS\Angler.bmp")
> Me.PictureBox1.Image = CreateFramedImage(b, Color.Yellow, 2)
> b.Dispose()
> ..
> ..
> ..
> Private Function CreateFramedImage( _
>     ByVal Source As Image, _
>     ByVal BorderColor As Color, _
>     ByVal BorderThickness As Integer _
> ) As Image
>     Dim b As New Bitmap( _
>         Source.Width + BorderThickness * 2, _
>         Source.Height + BorderThickness * 2 _
>     )
>     Dim g As Graphics = Graphics.FromImage(b)
>     g.Clear(BorderColor)
>     g.DrawImage(Source, BorderThickness, BorderThickness)
>     g.Dispose()
>     Return b
> End Function
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>