Results 1 to 3 of 3

Thread: Another Question I'm Sure You'll Know

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Oklahoma
    Posts
    1

    Angry I'm Having Troubles

    Is there something special i have to do to change the title bars color? my colors are all real weird, or maybe i'm just retarded. i can't seem to get the button text to change just the background color. any help would be greatly appreciated

    [Edited by Filth-Pig on 06-13-2000 at 01:39 AM]

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb SetSysColors API will do

    With the SetSysColors API you can change all the System color.

    Code:
    Option Explicit
    Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long
    Const COLOR_ACTIVECAPTION = 2
    
    Private Sub Command1_Click()
      SetSysColors 1, 2, vbRed
    End Sub

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb sample program

    I just write a sample program that you can change all the system color that you want and the code is here:

    If you need the sample project, just email me & I'll send it to you.
    Code:
    Option Explicit
    Const COLOR_SCROLLBAR = 0
    Const COLOR_BACKGROUND = 1
    Const COLOR_ACTIVECAPTION = 2
    Const COLOR_INACTIVECAPTION = 3
    Const COLOR_MENU = 4
    Const COLOR_WINDOW = 5
    Const COLOR_WINDOWFRAME = 6
    Const COLOR_MENUTEXT = 7
    Const COLOR_WINDOWTEXT = 8
    Const COLOR_CAPTIONTEXT = 9
    Const COLOR_ACTIVEBORDER = 10
    Const COLOR_INACTIVEBORDER = 11
    Const COLOR_APPWORKSPACE = 12
    Const COLOR_HIGHLIGHT = 13
    Const COLOR_HIGHLIGHTTEXT = 14
    Const COLOR_BTNFACE = 15
    Const COLOR_BTNSHADOW = 16
    Const COLOR_GRAYTEXT = 17
    Const COLOR_BTNTEXT = 18
    Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
    Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long
    
    Private DefaultColor(18) As Long
    Private xCnt&
    Private Sub CmdAction_Click(Index As Integer)
    Select Case Index
    Case 0 'Save Default
        Me.MousePointer = vbHourglass
        For xCnt = 0 To 18
            DefaultColor(xCnt) = GetSysColor(xCnt)
        Next
        Me.MousePointer = vbDefault
    Case 1 'Restore
        Me.MousePointer = vbHourglass
        For xCnt = 0 To 18
            SetSysColors 19, xCnt, DefaultColor(xCnt)
        Next
        Me.MousePointer = vbDefault
    Case 2 'Change
        SetSysColors 1, CLng(cboConst.ListIndex), picColor.BackColor
    Case 3 'Color Dialog
        On Error GoTo CDlg_Cancel
        CDlg.ShowColor
        picColor.BackColor = CDlg.Color
    CDlg_Cancel:
        Exit Sub
    End Select
    End Sub
    
    Private Sub Form_Load()
    With cboConst
        .AddItem "SCROLLBAR"
        .AddItem "BACKGROUND"
        .AddItem "ACTIVECAPTION"
        .AddItem "INACTIVECAPTION"
        .AddItem "COLOR_MENU"
        .AddItem "WINDOW"
        .AddItem "WINDOWFRAME"
        .AddItem "MENUTEXT"
        .AddItem "WINDOWTEXT"
        .AddItem "CAPTIONTEXT"
        .AddItem "ACTIVEBORDER"
        .AddItem "INACTIVEBORDER"
        .AddItem "APPWORKSPACE"
        .AddItem "HIGHLIGHT"
        .AddItem "HIGHLIGHTTEXT"
        .AddItem "BTNFACE"
        .AddItem "BTNSHADOW"
        .AddItem "GRAYTEXT"
        .AddItem "BTNTEXT"
        .ListIndex = 0
    End With
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width