We have learned Binary, Octal & Hexadecimal Numbering Systems and learned few simple rules by which we can devise new numbering systems with any Base value, provided the user knows about it and can decipher the new number. 

Last week we have worked with a Form to enter Decimal Numbers and get it converted into Binary as well as to display the RGB Color for that number.

If you would like to learn and understand Binary, Octal and Hexadecimal Numbering Systems then check the following Posts:

  1. Learn Binary Numbering System
  2. Learn Binary Numbering System-2
  3. Octal Numbering System
  4. Hexadecimal Numbering System
  5. Colors 24 bits and binary conversion

This week, we will work with a Form based Utility that is more useful to you at design time of a new Project.  You can create your own 24 bit custom colors visually and save up to 15 colors in a Color Palette on the Form. You can pick any of this colors and apply it on Form background or on other Control's Foreground, Background or Border Color Properties at design time.

An  image of the Employees Form in Design View with the Form's Header Section Property Sheet along with the Color Palette Form is given below for reference:

colorpallette2

A new custom color is created on the color palette Form (see the big rectangle) and applied it on the Employees Form Header Section Background, by setting the color value in the Back Color Property.

Click on the image to enlarge it.  The Employees Form is in Design View, its Header Section is in selected state and its Property Sheet with the Back Color Property is visible.  When you click on one of the grid of 15 Color Boxes (these you can create yourself and save it in each box of the color palette, over-writing the existing ones) will display its corresponding color number in the Text Box above the Color Palette with RGB Color label.  You can Copy (Ctrl+C) and Paste (Ctrl+V) into the Property Sheet for Value: Back Color, Fore Color or Border Color, as the case may be, to set the Color of Form Background or Control Colors.

If you are using MS-Access2007 the Color Values in the above Properties will be shown in Hexadecimal Form with the hash symbol like #4E61BC.  But you can paste the Decimal Color Value there and it will automatically convert into Hexadecimal form.  Since, we have learned Hexadecimal Numbering System I want to draw your attention to a small problem in Microsoft Access2007.

Let us take a sample Color Number in Decimal: 12345678 for the Form Header or Detail Section Background and paste it (or type it) into the Property Sheet and press Enter key. It will be converted into Hexadecimal Number like #4E61BC and the Form Background will be filled with a Dark Blue Color.  Take note of the first two digits and last two digits of Hexadecimal Number shown in blue and red colors.

  1. Now, open the VBA Editing Window (Alt+F11) and display the Debug window (Ctrl+G)
  2. Type ? HEX(12345678) and press Enter key to convert the Decimal Number 12345678 into Hexadecimal Number. The Question mark is the Print Command.
  3. The result will be BC614E and if you paste this value into the Property Sheet as #BC614E it will be accepted as it is and the color displayed will be Dark Red Color instead of Dark Blue.  Compare this number with the earlier number shown in blue and red colors.  MS-Access2007 converts the Color Decimal Number into Hexadecimal form and switches the right-most two Hexadecimal digits with the left-most two digits because it handles the color values (Red and Blue positions) differently.
  4. Suppose you have a Color Value in Hexadecimal form like 614E (24910 decimal) while pasting the value into the Property sheet you must change it to #4E6100 to get the Color equal to the decimal value 24910.  The color number is always expressed in 6 digit hexadecimal number. 
  5. The safest method is to Paste the decimal value into the Color Property and let MS-Access2007 take care of the conversion part.

Now, we will look at the simple trick of designing new Colors (logically you have over 16 Million 24 Bit Colors to work with) and saving it on the Color palette for later use. 

colorpallette

You can download a database with the above Form with the Programs from a link at the bottom of this Article, so that you can Import this Form into your new Projects, design your own colors and use them on your Forms or Controls.

You can click on the above image to enlarge it to view the controls properly.  Let us examine the controls on the Form.

  1. There are three Scrollbar controls to input the integer values from 0 - 255 for Red, Green and Blue colors (primary colors) by moving the Scrollbar's slider controls to the right to increase the value, or left to decrease the value, of each color. If you click on the arrow marks on the right/left edges of the scrollbars then the values will increase by 1 on each click or if you click and hold the control then the value will increase/decrease rapidly and the color graph also will change with it.  You can watch the large rectangle at the bottom right how the new color is formed by changing the colors with the Red, Green and Blue Scrollbars.
  2. The Bar Graph at the right of the scrollbars gives a visual indication of the variation of color values, which mixes together to form the new color, and the decimal values appear in the Text Boxes at the left, with the labels Red, Green and Blue.
  3. The big rectangle label control, at the bottom right of the Form, displays the new color created by setting the values in the scrollbar control.
  4. The Text Box with the Label RGB Color displays the RGB Color Number.
  5. You can highlight the number in the RGB Color Text Box and Copy (Ctrl+C) the Number and Paste (Ctrl+V) it in the Form's/Control's Back Color, Fore Color or Border Color Property to set the Color there.
  6. If you would like to preserve this newly created color then you can Click on the big rectangle, to pick the Color from there, then click on one of the 15 color boxes shown at the left to store that color there for later use.
  7. If you want to pick a color from one of the saved colors then click on it.  The selected color number will appear in the RGB Color Text Box above.  You can Copy and Paste it in the Color Property of the Form or Control.

Tips:

  1. You have the RGB Color Number, but you want to modify it to your liking then Copy and Paste that color decimal number into the RGB Color Text Box (or type it in) and press the Enter Key.  The color will appear in the big rectangle and the Red, Green and Blue Text Boxes will display their corresponding color values. The Bar Chart will give you a visual clue of each color at a glance.  You may then move the slider of the Scrollbar Controls to modify the color.
  2. If you are using MS-Access2007 then you must convert the Hexadecimal Number into Decimal Number by typing ? &hXXxxXX in the Debug Window, where xX stands for Hexadecimal digits. Don't forget to interchange the rightmost two digits with the leftmost two digits of the six digit hexadecimal number.  You will get the result in Decimal Number form and then you can copy it into the RGB Color Text Box to modify.
  3. You can directly enter integer values (Ranging from 0 to 255) in Red, Green and Blue Text Boxes given at the left of the Scrollbar Controls to create a new color.
Technorati Tags: ,,


Download Demo Database


Digital Clock on Main Switchboard
Label Animation Zoom out Fade
Label Animation in Color
Label Animation Zoom-in Style
Label Animation Variant