HowTo: Generate Random Colors In Visual Basic 6 - VB Helper

Home Search What's New Index Books Links Q & A Newsletter Banners Feedback Tip Jar
C# Helper...
XML RSS Feed Follow VBHelper on Twitter
MSDN Visual Basic Community
TitleGenerate random colors in Visual Basic 6
DescriptionThis example shows how to generate random colors in Visual Basic 6.
Keywordscolor, random color, RGB, QBColor
CategoriesGraphics, VB.NET
Module RandomColors contains two functions that return random colors. Function RandomQBColor selects a random number between 0 and 15 and returns the corresponding QBColor value.

Function RandomRGBColor randomly generates random red, green, and blue components for a color. It passes them into the RGB function and returns the result.

' Return a random QB color. Public Function RandomQBColor() As Long RandomQBColor = QBColor(Int(Rnd() * 16)) End Function ' Return a random RGB color. Public Function RandomRGBColor() As Long RandomRGBColor = RGB( _ Int(Rnd() * 256), _ Int(Rnd() * 256), _ Int(Rnd() * 256)) End Function
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc. All rights reserved.
Updated

Từ khóa » Visual Basic Colours