473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Insert Border around a picture

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

Nov 21 '05 #1
4 7389
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" <Ar**@discussions.microsoft.com> wrote in message
news:9D**********************************@microsof t.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

Nov 21 '05 #2
"Aris" <Ar**@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/>
Nov 21 '05 #3
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.
"Herfried K. Wagner [MVP]" wrote:
"Aris" <Ar**@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/>

Nov 21 '05 #4
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
"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" <Ar**@discussions.microsoft.com> wrote in message
news:9D**********************************@microsof t.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


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Vigil | last post by:
I am trying to put a 7px border around a page. If the contents don't fill up the viewport, then the border must appear all around the viewport. If the page is larger than the viewport, then the...
15
by: Oliver | last post by:
Hello i want to get a nice border around images, but not just with the simple <img src"....." border="1"> tag. I tried it in CSS. I did the following: <div class="img_class"> <img...
23
by: Bob Bedford | last post by:
I've a table. The table must not have any border. The TR (every line) must have a border, but not the lines between cells. The TR.pages must have no border. so .mytable{border:0px;} ...
5
by: Mel | last post by:
is it possible to draw a border around a row of a table ? example please... thanks
1
by: Keith Smith | last post by:
When I use this code.... window.open('gallery/pic1.jpg','windowname','width=775,height=550,resizable=yes,scrollbars=yes,top=10,left=10'); ....my web page displays a picture with a white border...
8
by: UJ | last post by:
I have a table with multiple cells and I want to draw a box around the entire table but not around the individual cells. How do I do that? TIA - Jeff.
1
by: constantlearner | last post by:
I have the following code, which you can paste into an html file and try. In IE, a border appears around the selection box. How do I make the border around the selection box transparent, or have no...
5
by: smittie31 | last post by:
I am having a problem with a border around me html page. The border does not flow thru the whole html page, it cuts off halfway. --> See http://keithborom.com/marlon-sanders CSS STYLESHEET ...
1
by: MarwaAlSagheer | last post by:
Hi, I have form with Picture box and button. Flat appearance of button is flat and Border style of Picture box is none. Problem is when window lost focus, there are white border appear around...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.