473,385 Members | 1,901 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.

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 12399
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mudcat | last post by:
Hello, I would like to change the color of the default border around frames or widgets. Note: not the highlight border, but the default border. There have been many previous requests about the...
3
by: Billy | last post by:
Hello, I'm having a problem dynamically changing the color of a table background. I'm not sure exactly how to word this, but I'll give an example. I have a function called greentored(propname)...
1
by: Omar Llanos | last post by:
How can I change the background color of an MDI form? I read in msdn that it takes the background of windows (and not the BackColor) but I wanted to really make sure. I know that in VC it can be...
1
by: Pablo | last post by:
I do not know like changing the color of bottom of: a menu, of the bar of the title of form, messagebox?
1
by: Steve | last post by:
C# WinForms I am trying to find a good solution for changing the color of a row in a datagrid, at runtime, based on the contents of a certain cell of the row, or a related value in the database....
0
by: Nagastyle | last post by:
How to changing bg color when redirect or hyperlink to another form?
1
by: sarangjavkhedkar | last post by:
changing the color of command button caption
2
by: Josephbupe | last post by:
Hello everyone. I would like to have a text box with a code that would allow changing text color depending on the name of the colour. For instance, if i type in "GREEN" the colour of text GREEN...
3
rampraveen
by: rampraveen | last post by:
hey guys,anybody know how to change the output color.when i executing a program always it is shown only in black color..will you tell what is the procedure for changing output color of font.....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.