changing PictureBox color border

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Back
Top