[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how does the "BackColor" Long Integer work?

Posted on 2006-04-03
7
Medium Priority
?
230 Views
Last Modified: 2008-02-26
white = 16777215
pink = 13027071
blue = 15977088

(or there abouts)

what i'm asking is, if i want to tweek the shade a little, what's the logic?

i thought it might be RRR GGG BBB but (besides there not being 9 digits) i've been playing with it, and i can't determine any rhyme to it.

for the points, please tell me what digits control what aspects of the color (or a good web site where this information can be found)

thanks,
mac

0
Comment
Question by:MacRena
7 Comments
 
LVL 42

Accepted Solution

by:
dqmq earned 160 total points
ID: 16366022
Here's the color constants (in hex) which I believe are additive.  


vbRed         0x0000FF       Red
vbGreen      0x00FF00       Green
vbBlue        0xFF0000       Blue


For example, to Yellow = Red + Green = 0x0000FF + 0x00FF00 = 0x00FFFF

To get less red, subtract n *  (2 ^ 0)  where n = 1 to 255
To get less green, subtract n * (2 ^ 8) where n = 1 to 255
To get less blue, subtract n * (2 ^ 16) where n = 1 to 255
0
 
LVL 58

Assisted Solution

by:harfang
harfang earned 160 total points
ID: 16366401
If you want to tweak the colors, use the built-in RGB() function:

    RGB(255,255,255) = 16777215 (white)
    RGB(0,0,255) = 16711680 (blue)
    RGB(255,0,0) = 255 (red)

If you are familiar with Hex notation, you can go:

    .BackColor = &HFFFFFF& (white)
    .BackColor = &H00FF00& (green)
    .BackColor = &H0000FF& (red)

Note however that the VB colors are coded "BGR" (as explained by dqmg) with red = &HFF, unlike the "internet colors" coded "RGB" with red = 0xff0000

And you can also just click the builder button on any "color" property, pick your color in the dialog box and then remember the numeric  value.

Good luck!
(°v°)
0
 
LVL 39

Assisted Solution

by:thenelson
thenelson earned 160 total points
ID: 16366663
And you will find a great free tool for tweaking colors (and other things) here:
http://personales.conexion.com.py/sgrillo/
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 52

Assisted Solution

by:Gustav Brock
Gustav Brock earned 160 total points
ID: 16372655
Here's how to extract the discrete colours:

Public Sub CompositeRGB( _
  ByVal lngRGB As Long, _
  ByRef intRed As Integer, _
  ByRef intGreen As Integer, _
  ByRef intBlue As Integer)
 
' Calculate discrete RGB colours from composite colour value.
'
' 1999-08-20. Cactus Data ApS, CPH
 
  If lngRGB < 0 Then
    ' Nothing to do.
    intRed = 0
    intGreen = 0
    intBlue = 0
  Else
    ' Dissolve composite RGB into discrete colours.
    intRed = lngRGB And vbRed
    intGreen = (lngRGB And vbGreen) / &H100
    intBlue = (lngRGB And vbBlue) / &H10000
  End If
  Debug.Print intRed, intGreen, intBlue

End Sub
0
 
LVL 4

Author Comment

by:MacRena
ID: 16375500
thanks everyone.
hmmm, 50 points won't go far.  increasing to split
mac
0
 
LVL 58

Expert Comment

by:harfang
ID: 16375669
It was kind of you to increase points and to aknowledge all contributions. Thanks!
(°v°)
0
 
LVL 39

Expert Comment

by:thenelson
ID: 16375907
You're welcome.  Glad to help and thank you very much for the points with "A" grade!  Thanks for the split.

Happy Computing!

Nelson
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question