473,837 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12439
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************ ****@discussion s.microsoft.com > wrote
in message news:F0******** *************** ***********@mic rosoft.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
9101
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 highlight border, but I couldn't find anything on changing the default border color. I know how to change the border relief and width but have found no way to change the color of it. Is there a way to do that?
3
2018
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) i want to be able to change the following to a different color: document.all.propname.style.visibility
1
6734
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 done. Thanks.
1
1824
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
1511
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. I cant believe it is as hard as I am finding. This is surely a common problem. All the solutions I have found so far though, seem very specific, and that if I want this in various datagrids through my application I will have to have a load...
0
1030
by: Nagastyle | last post by:
How to changing bg color when redirect or hyperlink to another form?
1
1542
by: sarangjavkhedkar | last post by:
changing the color of command button caption
2
3025
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 should be in green, and if i type in "BLUE" the text should be in the colour blue. I want this to be done with RED, ORANGE, YELLOW, BLUE, GREEN and BLACK. How can i do it.
3
1761
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
9682
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10881
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10628
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10275
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7807
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7004
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5670
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5850
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3126
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.