Difference between revisions of "Color Constants / Color Forms / Controls / Transparency VB6"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
Line 1: Line 1:
== Table 1 ==
+
== VB / VBA Color Constants ==
 +
 
 +
=== Table 1 ===
  
 
{| border="1" frame="below" rules="rows" cellpadding="5" frame="below" rules="rows"
 
{| border="1" frame="below" rules="rows" cellpadding="5" frame="below" rules="rows"
Line 167: Line 169:
 
 
 
 
  
== Table 2 ==
+
=== Table 2 ===
  
 
{| width="624" border="1" cellspacing="1" bgcolor="#c0c0c0"
 
{| width="624" border="1" cellspacing="1" bgcolor="#c0c0c0"
Line 278: Line 280:
 
 
 
 
  
== Examples ==
+
=== Examples ===
  
 
Example 1:
 
Example 1:
Line 285: Line 287:
 
Example 2: This is the same as "Button Highlight"
 
Example 2: This is the same as "Button Highlight"
 
  txtCon(cnt).BackColor = vbHighlightText
 
  txtCon(cnt).BackColor = vbHighlightText
 +
 +
 
 +
 +
== Setting Form and Control Colors ==
 +
 +
* Blue : Me.BackColor = RGB(0, 0, 255)
 +
  Me.BackColor = RGB(0, 0, 255)
 +
* Green: Me.BackColor = RGB(0, 255, 0)
 +
  Me.BackColor = RGB(0, 255, 0)
 +
* Red: Me.BackColor = RGB(255, 0, 0)
 +
  Me.BackColor = RGB(255, 0, 0)
 +
 +
 
  
 
 
 
 

Revision as of 12:04, 10 February 2008

VB / VBA Color Constants

Table 1

VBA Constant SystemColors Hex Value Long Value Description
vb3DDKShadow ControlDarkDark &H80000015 -2147483627 Darkest shadow color for 3-D display elements
vb3DHighlight ControlLightLight &H80000014 -2147483628 Highlight color for 3-D display elements
vb3DLight ControlLight &H80000016 -2147483626 Second lightest 3-D color after vb3DHighlight
vb3DShadow ControlDark &H80000010 -2147483632 Lightest shadow color for 3-D display elements
vbActiveBorder ActiveBorder &H8000000A -2147483638 Border color of active window
vbActiveTitleBar ActiveCaption &H80000002 -2147483646 Color of the title bar for the active window
vbApplicationWorkspace AppWorkspace &H8000000C -2147483636 Background color of multiple document interface (MDI) applications
vbButtonFace (vb3DFace) Control &H8000000F -2147483633 Color of shading on the face of command buttons
vbButtonShadow (vb3DShadow) ControlDark &H80000010 -2147483632 Color of shading on the edge of command buttons
vbButtonText ControlText &H80000012 -2147483630 Text color on push buttons
vbDesktop Desktop &H80000001 -2147483647 Desktop color
vbGrayText GrayText &H80000011 -2147483631 Grayed (disabled) text
vbHighlight Highlight &H8000000D -2147483635 Background color of items selected in a control
vbHighlightText HighlightText &H8000000E -2147483634 Text color of items selected in a control
vbInactiveBorder InactiveBorder &H8000000B -2147483637 Border color of inactive window
vbInactiveCaptionText InactiveCaptionText &H80000013 -2147483629 Color of text in an inactive caption
vbInactiveTitleBar InactiveCaption &H80000003 -2147483645 Color of the title bar for the inactive window
vbInfoBackground(vbMsgBoxText) Info &H80000018 -2147483624 Background color of ToolTips
vbInfoText(vbMsgBox) InfoText &H80000017 -2147483625 Color of text in ToolTips
vbMenuBar Menu &H80000004 -2147483644 Menu background color
vbMenuText MenuText &H80000007 -2147483641 Color of text on menus
vbScrollBars ScrollBar &H80000000 -2147483648 Scrollbar color
vbTitleBarText ActiveCaptionText &H80000009 -2147483639 Color of text in caption, size box, and scroll arrow
vbWindowBackground Window &H80000005 -2147483643 Window background color
vbWindowFrame WindowFrame &H80000006 -2147483642 Window frame color
vbWindowText WindowText &H80000008 -2147483640 Color of text in windows

 

Table 2

System Colour Name Hex Value VB Constant
Menu Text &H80000007& vbMenuText
Scroll Bars &H80000000& vbScrollBars
Window Background &H80000005& vbWindowBackground
Window Frame &H80000006& vbWindowFrame
Window Text &H80000008& vbWindowText
Active Border &H8000000A& vbActiveBorder
Active Title Bar &H80000002& vbActiveTitleBar
Active Title Bar Text &H80000009& vbTitleBarText
Application Workspace &H8000000C& vbApplicationWorkspace
Button Face &H8000000F& vbButtonFace
Button Highlight &H80000014& vb3DHighlight
Button Shadow &H80000010& vb3DDKShadow
Button Text &H80000012& vbButtonText
Desktop &H80000001& vbDesktop
Disabled Text &H80000011& vbGrayText
Highlight &H8000000D& vbHighlight
Highlighted Text &H8000000E& vbHighlightText
Inactive Border &H8000000B& vbInactiveBorder
Inactive Title Bar &H80000003& vbInactiveTitleBar
Inactive Title Bar Text &H80000013& vbInactiveCaptionText
Menu Bar &H80000004& vbMenuBar

 

Table 3

The eight members of the VBA Color Constants class:

  • vbBlack
  • vbWhite
  • vbRed
  • vbGreen
  • vbBlue
  • vbYellow
  • vbMagenta
  • vbCyan

 

Examples

Example 1:

txtCon(cnt).BackColor = vbHighlightText

Example 2: This is the same as "Button Highlight"

txtCon(cnt).BackColor = vbHighlightText

 

Setting Form and Control Colors

  • Blue : Me.BackColor = RGB(0, 0, 255)
 Me.BackColor = RGB(0, 0, 255)
  • Green: Me.BackColor = RGB(0, 255, 0)
 Me.BackColor = RGB(0, 255, 0)
  • Red: Me.BackColor = RGB(255, 0, 0)
 Me.BackColor = RGB(255, 0, 0)