470,833 Members | 1,389 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

changing PictureBox color border


Hi,
I have a PictureBox with the border set to BorderStyle = FixedSingle
and it comes up with a nice Black border.

How can I change it at runtime?

I use VS2005 (net2 framework)

Many Thanks,
Filippo

Mar 3 '06 #1
1 12102
Hi Filippo,

Set the BorderStyle to None. Set the Padding on the Control to the width you
want your Border to be. Set the BackColor property to the color you want
your border to be. Note: the image must be the size of the available space
minus the padding) in the PictureBox for this to work. This can be done by
setting the SizeMode of the PictureBox to AutoSize or StretchImage. Or the
image can simply be the size of the client area of the Control, minus the
padding.

You can also do it without using Padding, by using SizeMode set to
CenterImage, and making the PictureBox wider than the image by the number of
pixels you want the border to be.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

"Filippo Bettinaglio" <Fi****************@discussions.microsoft.com> wrote
in message news:F0**********************************@microsof t.com...

Hi,
I have a PictureBox with the border set to BorderStyle = FixedSingle
and it comes up with a nice Black border.

How can I change it at runtime?

I use VS2005 (net2 framework)

Many Thanks,
Filippo

Mar 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mudcat | last post: by
1 post views Thread by Omar Llanos | last post: by
rampraveen
3 posts views Thread by rampraveen | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.