If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Where can I find all the "color codes"?
Hi,
I am trying to change Back Color of some rectangles, but I don't know what "code" is for which color (except black=0 and red=225) in Visual Basic. Can anyone please help? I'm actually after dark grey and light grey, but it'd be nice to know a list of color codes for all colors in the palette. Many thanks Regards, Sam |
#2
|
|||
|
|||
here are the colour constants from the vba help file:
System Color Constants The following constants can be used anywhere in your code in place of the actual values: Constant Value Description vbScrollBars = Scroll bar color vbDesktop = Desktop color vbActiveTitleBar = Color of the title bar for the active window vbInactiveTitleBar = Color of the title bar for the inactive window vbMenuBar = Menu background color vbWindowBackground = Window background color vbWindowFrame = Window frame color vbMenuText = Color of text on menus vbWindowText = Color of text in windows vbTitleBarText = Color of text in caption, size box, and scroll arrow vbActiveBorder = Border color of active window vbInactiveBorder = Border color of inactive window vbApplicationWorkspace = Background color of multiple-document interface (MDI) applications vbHighlight = Background color of items selected in a control vbHighlightText = Text color of items selected in a control vbButtonFace = Color of shading on the face of command buttons vbButtonShadow = Color of shading on the edge of command buttons vbGrayText = Grayed (disabled) text vbButtonText = Text color on push buttons vbInactiveCaptionText = Color of text in an inactive caption vb3DHighlight = Highlight color for 3-D display elements vb3DDKShadow = Darkest shadow color for 3-D display elements vb3DLight = Second lightest 3-D color after vb3DHighlight vbInfoText = Color of text in ToolTips vbInfoBackground = Background color of ToolTips vbBlack = Black vbRed = Red vbGreen = Green vbYellow = Yellow vbBlue = Blue vbMagenta = Magenta vbCyan = Cyan vbWhite = White Hope that helps John Webb -- Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
"=?Utf-8?B?U2FtIEt1bw==?=" .(donotspam) wrote in
: Hi, I am trying to change Back Color of some rectangles, but I don't know what "code" is for which color (except black=0 and red=225) in Visual Basic. Can anyone please help? I'm actually after dark grey and light grey, but it'd be nice to know a list of color codes for all colors in the palette. Many thanks Regards, Sam Hi, I got fed up with trying to calculate the color codes also, so I created this application (via VB) called RGB which lets me play with all values of Red, Green and Blue via sliders and shows the result along with the decimal, hex and full decimal number. Feel free to download it and try it out. It can be found at: http://shgreenberg.home.comcast.net/otherpgms.htm Anyone else feel free to try it out. it has certainly helped me many times before. There is no help but it is self explanatory, plus there are many other convenient things it can do. email me with any questions or suggestions. Steve Greenberg |
#4
|
|||
|
|||
Thanks John. I'm sure they are very helpful, especially those related to the
color of components that forms Access. I also found out another way of manually finding out the color constants. If I just go to the color property of whatever control I want to use, and click on the button on the right, which would then open up the palette. Then I can just pick whatever color I want and click OK. The equivalent color constant would then be shown in the color property box Regards, Sam "John Webb via AccessMonster.com" wrote: here are the colour constants from the vba help file: System Color Constants The following constants can be used anywhere in your code in place of the actual values: Constant Value Description vbScrollBars = Scroll bar color vbDesktop = Desktop color vbActiveTitleBar = Color of the title bar for the active window vbInactiveTitleBar = Color of the title bar for the inactive window vbMenuBar = Menu background color vbWindowBackground = Window background color vbWindowFrame = Window frame color vbMenuText = Color of text on menus vbWindowText = Color of text in windows vbTitleBarText = Color of text in caption, size box, and scroll arrow vbActiveBorder = Border color of active window vbInactiveBorder = Border color of inactive window vbApplicationWorkspace = Background color of multiple-document interface (MDI) applications vbHighlight = Background color of items selected in a control vbHighlightText = Text color of items selected in a control vbButtonFace = Color of shading on the face of command buttons vbButtonShadow = Color of shading on the edge of command buttons vbGrayText = Grayed (disabled) text vbButtonText = Text color on push buttons vbInactiveCaptionText = Color of text in an inactive caption vb3DHighlight = Highlight color for 3-D display elements vb3DDKShadow = Darkest shadow color for 3-D display elements vb3DLight = Second lightest 3-D color after vb3DHighlight vbInfoText = Color of text in ToolTips vbInfoBackground = Background color of ToolTips vbBlack = Black vbRed = Red vbGreen = Green vbYellow = Yellow vbBlue = Blue vbMagenta = Magenta vbCyan = Cyan vbWhite = White Hope that helps John Webb -- Message posted via http://www.accessmonster.com |
#5
|
|||
|
|||
Thanks Steven. Your RGB is indeed very handy. it means I can now just use
that to quickly find out the RGB values of whatever color I want even when I am not in Access, rather than having to indirectly go to the buil-in palette everytime. However, It seems Access defines the color constant differently? For example, color constant for Grey would be 8421504, but its RGB is 128, 128, 128. Therefore, I also found out another way of manually finding out the color constants for Access. If I just go to the color property of whatever control I want to use, and click on the button on the right, which would then open up the palette. Then I can just pick whatever color I want and click OK. The equivalent color constant would then be shown in the color property box Regards, Sam "Steven Greenberg" wrote: "=?Utf-8?B?U2FtIEt1bw==?=" .(donotspam) wrote in : Hi, I am trying to change Back Color of some rectangles, but I don't know what "code" is for which color (except black=0 and red=225) in Visual Basic. Can anyone please help? I'm actually after dark grey and light grey, but it'd be nice to know a list of color codes for all colors in the palette. Many thanks Regards, Sam Hi, I got fed up with trying to calculate the color codes also, so I created this application (via VB) called RGB which lets me play with all values of Red, Green and Blue via sliders and shows the result along with the decimal, hex and full decimal number. Feel free to download it and try it out. It can be found at: http://shgreenberg.home.comcast.net/otherpgms.htm Anyone else feel free to try it out. it has certainly helped me many times before. There is no help but it is self explanatory, plus there are many other convenient things it can do. email me with any questions or suggestions. Steve Greenberg |
#6
|
|||
|
|||
You can set colors programmatically using the RGB function :
Control.Backcolor = RGB(128,128,128) or QBColor from the old Quick Basic: Control.Backcolor = QBColor(8) or Control.Backcolor = 6421504 -- Arvin Meyer, MCP, MVP Microsoft Access Free Access downloads: http://www.datastrat.com http://www.mvps.org/access "Sam Kuo" .(donotspam) wrote in message ... Thanks Steven. Your RGB is indeed very handy. it means I can now just use that to quickly find out the RGB values of whatever color I want even when I am not in Access, rather than having to indirectly go to the buil-in palette everytime. However, It seems Access defines the color constant differently? For example, color constant for Grey would be 8421504, but its RGB is 128, 128, 128. Therefore, I also found out another way of manually finding out the color constants for Access. If I just go to the color property of whatever control I want to use, and click on the button on the right, which would then open up the palette. Then I can just pick whatever color I want and click OK. The equivalent color constant would then be shown in the color property box Regards, Sam "Steven Greenberg" wrote: "=?Utf-8?B?U2FtIEt1bw==?=" .(donotspam) wrote in : Hi, I am trying to change Back Color of some rectangles, but I don't know what "code" is for which color (except black=0 and red=225) in Visual Basic. Can anyone please help? I'm actually after dark grey and light grey, but it'd be nice to know a list of color codes for all colors in the palette. Many thanks Regards, Sam Hi, I got fed up with trying to calculate the color codes also, so I created this application (via VB) called RGB which lets me play with all values of Red, Green and Blue via sliders and shows the result along with the decimal, hex and full decimal number. Feel free to download it and try it out. It can be found at: http://shgreenberg.home.comcast.net/otherpgms.htm Anyone else feel free to try it out. it has certainly helped me many times before. There is no help but it is self explanatory, plus there are many other convenient things it can do. email me with any questions or suggestions. Steve Greenberg |
#7
|
|||
|
|||
On Sat, 2 Apr 2005 14:29:02 -0800, "Sam Kuo"
.(donotspam) wrote: However, It seems Access defines the color constant differently? For example, color constant for Grey would be 8421504, but its RGB is 128, 128, 128. The color code is a "packed" long integer: the RGB code is the Red value + 255 * the Green value + 65536 * the Blue value. Essentially, it's three 8-bit numbers packed into a 24 bit value. John W. Vinson[MVP] |
#8
|
|||
|
|||
On Sat, 02 Apr 2005 18:02:15 -0700, John Vinson
wrote: On Sat, 2 Apr 2005 14:29:02 -0800, "Sam Kuo" .(donotspam) wrote: However, It seems Access defines the color constant differently? For example, color constant for Grey would be 8421504, but its RGB is 128, 128, 128. The color code is a "packed" long integer: the RGB code is the Red value + 255 * the Green value + 65536 * the Blue value. Essentially, it's three 8-bit numbers packed into a 24 bit value. Oops... 256 * the green value, not 255. If you look at a color code in hex, a medium grey would be 0F0F0F = 986895. White is FFFFFF (full intensity of all colors); black is 000000; pure red is 0000FF = 255, pure green is 00FF00 = 65280, pure blue FF0000 = 16711680. John W. Vinson[MVP] |
#9
|
|||
|
|||
"=?Utf-8?B?U2FtIEt1bw==?=" .(donotspam) wrote in
: Thanks Steven. Your RGB is indeed very handy. it means I can now just use that to quickly find out the RGB values of whatever color I want even when I am not in Access, rather than having to indirectly go to the buil-in palette everytime. However, It seems Access defines the color constant differently? For example, color constant for Grey would be 8421504, but its RGB is 128, 128, 128. Therefore, I also found out another way of manually finding out the color constants for Access. If I just go to the color property of whatever control I want to use, and click on the button on the right, which would then open up the palette. Then I can just pick whatever color I want and click OK. The equivalent color constant would then be shown in the color property box Regards, Sam "Steven Greenberg" wrote: "=?Utf-8?B?U2FtIEt1bw==?=" .(donotspam) wrote in : Hi, I am trying to change Back Color of some rectangles, but I don't know what "code" is for which color (except black=0 and red=225) in Visual Basic. Can anyone please help? I'm actually after dark grey and light grey, but it'd be nice to know a list of color codes for all colors in the palette. Many thanks Regards, Sam Hi, I got fed up with trying to calculate the color codes also, so I created this application (via VB) called RGB which lets me play with all values of Red, Green and Blue via sliders and shows the result along with the decimal, hex and full decimal number. Feel free to download it and try it out. It can be found at: http://shgreenberg.home.comcast.net/otherpgms.htm Anyone else feel free to try it out. it has certainly helped me many times before. There is no help but it is self explanatory, plus there are many other convenient things it can do. email me with any questions or suggestions. Steve Greenberg I've incorporated that function (specifically for Access) into my RGB program. If you look at the right side where it says foreground and background. The label tells you both the decimal RGB (as in 255,125,331) and the Access version of the 24 bit number (as in 12640511). I just added that as my original RGB only had the RGB and HEX values. Try it out. Steve |
#10
|
|||
|
|||
Here is some info on Colors and WIndows from a previous post of mine:
For actual VB code to perform the conversion and a bit of an explanation on the various ways colors are represented in windows see: http://vbnet.mvps.org/index.ht*ml?co...latecol*or.htm For more detail here is a previous post of mine on this subject. For a detailed online Color FAQ see: http://www.inforamp.net/~poynt*on/Po...Specifica*lly: http://www.inforamp.net/~poynt*on/ColorFAQ.html For information on how windows represents colors see: http://msdn.microsoft.com/libr*ary/d...y/e*n-us/gdi/c ol ors_87zn.asp In case you do not have access to MSDN: Working with Color See Also Visual Basic uses a consistent system for all color properties and graphics methods. A color is represented by a Long integer, and this value has the same meaning in all contexts that specify a color. Specifying Colors at Run Time There are four ways to specify a color value at run time: Use the RGB function. Use the QBColor function to choose one of 16 Microsoft QuickBasic® colors. Use one of the intrinsic constants listed in the Object Browser. Enter a color value directly. This section discusses how to use the RGB and QBColor functions as simple ways to specify color. See "Using Color Properties" later in this chapter for information on using constants to define color or directly entering color values. Using the RGB Function You can use the RGB function to specify any color. To use the RGB function to specify a color Assign each of the three primary colors (red, green, and blue) a number from 0 to 255, with 0 denoting the least intensity and 255 the greatest. Give these three numbers as input to the RGB function, using the order red-green-blue. Assign the result to the color property or color argument. Every visible color can be produced by combining one or more of the three primary colors. For example: ' Set background to green. Form1.BackColor = RGB(0, 128, 0) ' Set background to yellow. Form2.BackColor = RGB(255, 255, 0) ' Set point to dark blue. PSet (100, 100), RGB(0, 0, 64) For More Information For information on the RGB function, see "RGB Function" in the Language Reference. Using Color Properties See Also Many of the controls in Visual Basic have properties that determine the colors used to display the control. Keep in mind that some of these properties also apply to controls that aren't graphical. The following table describes the color properties. Property Description BackColor Sets the background color of the form or control used for drawing. If you change the BackColor property after using graphics methods to draw, the graphics are erased by the new background color. ForeColor Sets the color used by graphics methods to create text or graphics in a form or control. Changing ForeColor does not affect text or graphics already created. BorderColor Sets the color of the border of a shape control. FillColor Sets the color that fills circles created with the Circle method and boxes created with the Line method. For More Information For detailed descriptions of these color properties, see "BackColor Property," "ForeColor Property," "BorderColor Property," and "FillColor Property" in the Language Reference. Defining Colors The color properties can use any of several methods to define the color value. The RGB function described in "Working with Color" is one way to define colors. This section discusses two more ways to define colors: Using defined constants Using direct color settings Using Defined Constants You don't need to understand how color values are generated if you use the intrinsic constants listed in the Object Browser. In addition, intrinsic constants do not need to be declared. For example, you can use the constant vbRed whenever you want to specify red as a color argument or color property setting: BackColor = vbRed Using Direct Color Settings Using the RGB function or the intrinsic constants to define color are in direct methods. They are indirect because Visual Basic interprets them into the single approach it uses to represent color. If you understand how colors are represented in Visual Basic, you can assign numbers to color properties and arguments that specify color directly. In most cases, it's much easier to enter these numbers in hexadecimal. The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF&). Each color setting (property or argument) is a 4-byte integer. The high byte of a number in this range equals 0. The lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). Consequently, you can specify a color as a hexadecimal number using this syntax: &HBBGGRR& The BB specifies the amount of blue, GG the amount of green, and RR the amount of red. Each of these fragments is a two-digit hexadecimal number from 00 to FF. The median value is 80. Thus, the following number specifies gray, which has the median amount of all three colors: &H808080& Setting the most significant bit to 1 changes the meaning of the color value: It no longer represents an RGB color, but an environment-wide color specified through the Windows Control Panel. The values that correspond to these system-wide colors range from &H80000000 to &H80000015. Note Although you can specify over 16 million different colors, not all systems are capable of displaying them accurately. For more information on how Windows represents colors, see "Working with 256 Colors" later in this chapter. Using System Colors When setting the colors of controls or forms in your application, you can use colors specified by the operating system instead of specific color values. If you specify system colors, when users of your application change the values of system colors on their computers, your application automatically reflects the user-specified color values. Each system color has both a defined constant and a direct color setting. The high byte of direct color settings for system colors differs from those of normal RGB colors. For RGB colors, the high byte equals 0 whereas for system colors the high byte equals 8. The rest of the number refers to a particular system color. For example, the hexadecimal number used to represent the color of an active window caption is &H80000002&. When you select color properties at design time with the Properties window, selecting the System tab lets you choose system settings, which are automatically converted into the hexadecimal value. You can also find the defined constants for system colors in the Object Browser. Constant Value Description vbScrollBars 0x80000000 Scroll bar color vbDesktop 0x80000001 Desktop color vbActiveTitleBar 0x80000002 Color of the title bar for the active window vbInactiveTitleBar 0x80000003 Color of the title bar for the inactive window vbMenuBar 0x80000004 Menu background color vbWindowBackground 0x80000005 Window background color vbWindowFrame 0x80000006 Window frame color vbMenuText 0x80000007 Color of text on menus vbWindowText 0x80000008 Color of text in windows vbTitleBarText 0x80000009 Color of text in caption, size box, and scroll arrow vbActiveBorder 0x8000000A Border color of active window vbInactiveBorder 0x8000000B Border color of inactive window vbApplicationWorkspace 0x8000000C Background color of multiple-document interface (MDI) applications vbHighlight 0x8000000D Background color of items selected in a control vbHighlightText 0x8000000E Text color of items selected in a control vbButtonFace 0x8000000F Color of shading on the face of command buttons vbButtonShadow 0x80000010 Color of shading on the edge of command buttons vbGrayText 0x80000011 Grayed (disabled) text vbButtonText 0x80000012 Text color on push buttons vbInactiveCaptionText 0x80000013 Color of text in an inactive caption vb3DHighlight 0x80000014 Highlight color for 3-D display elements vb3DDKShadow 0x80000015 Darkest shadow color for 3-D display elements vb3DLight 0x80000016 Second lightest 3-D color after vb3DHighlight vbInfoText 0x80000017 Color of text in ToolTips vbInfoBackground 0x80000018 Background color of ToolTips -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Sam Kuo" .(donotspam) wrote in message ... Thanks Steven. Your RGB is indeed very handy. it means I can now just use that to quickly find out the RGB values of whatever color I want even when I am not in Access, rather than having to indirectly go to the buil-in palette everytime. However, It seems Access defines the color constant differently? For example, color constant for Grey would be 8421504, but its RGB is 128, 128, 128. Therefore, I also found out another way of manually finding out the color constants for Access. If I just go to the color property of whatever control I want to use, and click on the button on the right, which would then open up the palette. Then I can just pick whatever color I want and click OK. The equivalent color constant would then be shown in the color property box Regards, Sam "Steven Greenberg" wrote: "=?Utf-8?B?U2FtIEt1bw==?=" .(donotspam) wrote in : Hi, I am trying to change Back Color of some rectangles, but I don't know what "code" is for which color (except black=0 and red=225) in Visual Basic. Can anyone please help? I'm actually after dark grey and light grey, but it'd be nice to know a list of color codes for all colors in the palette. Many thanks Regards, Sam Hi, I got fed up with trying to calculate the color codes also, so I created this application (via VB) called RGB which lets me play with all values of Red, Green and Blue via sliders and shows the result along with the decimal, hex and full decimal number. Feel free to download it and try it out. It can be found at: http://shgreenberg.home.comcast.net/otherpgms.htm Anyone else feel free to try it out. it has certainly helped me many times before. There is no help but it is self explanatory, plus there are many other convenient things it can do. email me with any questions or suggestions. Steve Greenberg |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
using "find and replace" box to navigate through forms | Lucas | Using Forms | 0 | December 20th, 2004 03:27 PM |
Paste into a field in Find and Replace | Nottinghambay | General Discussion | 1 | November 2nd, 2004 05:15 PM |
How to find the gap? | Günter Brandstätter | General Discussion | 6 | September 3rd, 2004 12:02 PM |
Specify Find options | Dave The Brain | General Discussion | 3 | July 29th, 2004 04:55 PM |
decipher log of scanpst.exe | km | General Discussion | 0 | July 18th, 2004 09:00 AM |