Quickly change colors with VB6's Color Palette

Developers grow accustomed to using certain tools in their toolbox, often forgetting about other useful features that at their disposal. See what you can do with one of these little-used tools: Visual Basic 6's Color Palette.

Advance your scripting skills to the next level with TechRepublic's free Visual Basic newsletter, delivered each Friday. Automatically sign up today!

A little-used tool in the Visual Basic 6 design environment is the Color Palette. This tool lets you quickly assign colors to forms and also to define custom colors.

To use the Color Palette, first select a form in the designer. Then select View | Color Palette to display the palette. It displays a grid of about 60 squares. Most of these squares contain a predefined color; the others are white. Clicking a square assigns that color as the form's background color. It's fast and easy to try different colors to see what they look like. Click the Default button to return the form to the default medium gray.

To define a custom color, click one of the white squares in the palette and then click the Define Colors button. Another dialog box opens in which you can define your custom color. When you have defined a color, click Add Color to return to the Color Palette and add the color to the square. You can now apply this new color (or any of the other colors) to a form.

Editor's Picks

Free Newsletters, In your Inbox