473,473 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I modify colors like Windows does to make 3D border slightly darker or lighter?

If you look at a standard Button in a .NET Windows Forms app, you will
notice its default BackColor is "Control" and it has a 3D raised border
which is 2 pixels wide. The outer edge on the left and top is
"ControlLightLight" color and the inner edge on the left and top is
"ControlLight". The outer edge on the right and bottom is
"ControlDarkDark" and the inner edge on the right and bottom is
"ControlDark". All of these colors are defined as KnownColors in the
System.Drawing namespace.

My question is this, when you change the BackColor of the button to
"Red", the border colors are adjusted as well. The top and left is made
slightly lighter versions of red while the bottom and right are made
slightly darker versions of red.

How can I take a given color such as Red, Green, ... and get their
slightly lighter and darker versions? There doesnt appear to be any
methods in the Color structure or ColorConverter class.

Any ideas?

Nov 21 '05 #1
3 2790
The ControlPaint class might have something that you can use.

--
Tim Wilson
..Net Compact Framework MVP

<jr*******@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
If you look at a standard Button in a .NET Windows Forms app, you will
notice its default BackColor is "Control" and it has a 3D raised border
which is 2 pixels wide. The outer edge on the left and top is
"ControlLightLight" color and the inner edge on the left and top is
"ControlLight". The outer edge on the right and bottom is
"ControlDarkDark" and the inner edge on the right and bottom is
"ControlDark". All of these colors are defined as KnownColors in the
System.Drawing namespace.

My question is this, when you change the BackColor of the button to
"Red", the border colors are adjusted as well. The top and left is made
slightly lighter versions of red while the bottom and right are made
slightly darker versions of red.

How can I take a given color such as Red, Green, ... and get their
slightly lighter and darker versions? There doesnt appear to be any
methods in the Color structure or ColorConverter class.

Any ideas?

Nov 21 '05 #2
<jr*******@hotmail.com> schrieb:
How can I take a given color such as Red, Green, ... and get their
slightly lighter and darker versions? There doesnt appear to be any
methods in the Color structure or ColorConverter class.


'ControlPaint.Dark'
'ControlPaint.DarkDark'
'ControlPaint.Light'
'ControlPaint.LightLight'

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
jrhoads23,
As Tim suggests I use System.Windows.Forms.ControlPaint.

Specifically:
- ControlPaint.Dark
- ControlPaint.DarkDark
- ControlPaint.Light
- ControlPaint.LightLight

Something like:

Dim lightBackColor As Color = ControlPaint.Light(BackColor)
Dim lightLightBackColor As Color = ControlPaint.LightLight(BackColor)
Dim darkBackColor As Color = ControlPaint.Dark(BackColor)
Dim darkDarkBackColor As Color = ControlPaint.DarkDark(BackColor)
Hope this helps
Jay

<jr*******@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
If you look at a standard Button in a .NET Windows Forms app, you will
notice its default BackColor is "Control" and it has a 3D raised border
which is 2 pixels wide. The outer edge on the left and top is
"ControlLightLight" color and the inner edge on the left and top is
"ControlLight". The outer edge on the right and bottom is
"ControlDarkDark" and the inner edge on the right and bottom is
"ControlDark". All of these colors are defined as KnownColors in the
System.Drawing namespace.

My question is this, when you change the BackColor of the button to
"Red", the border colors are adjusted as well. The top and left is made
slightly lighter versions of red while the bottom and right are made
slightly darker versions of red.

How can I take a given color such as Red, Green, ... and get their
slightly lighter and darker versions? There doesnt appear to be any
methods in the Color structure or ColorConverter class.

Any ideas?

Nov 21 '05 #4

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

Similar topics

0
by: Yarik | last post by:
Hello, When I open an HTML document by Internet Explorer 6 and then print the document on a color inkjet printer, some of the colors are rendered incorrectly (they appear much darker than they...
3
by: Viken Karaguesian | last post by:
Hello all, Me again :>) Can I modify certain attributes in a style within a stylesheet? Example: I have a style sheet that looks like this: body { background-color: black; font-family: Arial;...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
8
by: Todd Smith | last post by:
I'm wondering if anyone knows where I can learn a good programming method for creating windows apps. I'm just starting to learn windows programming with MSVC++ 6.0. I want to learn low level...
4
by: MC D | last post by:
I have a aspx page that outputs an image to the response.outputstream. This works great. However, I want to be able to make the image it outputs a .gif file. I can change the output type to...
3
by: jrhoads23 | last post by:
If you look at a standard Button in a .NET Windows Forms app, you will notice its default BackColor is "Control" and it has a 3D raised border which is 2 pixels wide. The outer edge on the left and...
3
by: Jerry Camel | last post by:
Is there a simple way to get a lighter or darker version of a color? I can convert to HSL and change the L value and then convert back. Or I can just bump the RGB values up or down by a...
4
by: Jmc | last post by:
Hi Need some advice on how to get all colors in an image. I wish to have an input file, in my case it will be a scanned piece of fabric. I would like to first of all gen an array with all the...
9
by: Adam | last post by:
I am working on the following site: http://bricktroop60.awardspace.com/ for my scout troop. It looks good in Firefox and Opera, but Internet Exploder renders the colors differently. Does anyone...
6
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
Is there any way to change or turn off the border of an Windows.Forms.MdiClient control? In my opinion the 3D bevel that the control uses is outdated and looks poor in my app. The best would be a...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.