Results 1 to 2 of 2

Thread: Enums

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Location
    Staffodshire, England
    Posts
    32

    Smile

    Is it possible and if so how, to change the color of system color constants using the enum statement.

    Im trying to change the tooltip colors (vbinfobackground).

    Thanks in advance!

    Mark_Dep

  2. #2
    Guest
    Try this.

    Code:
    Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long
    Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
    Const COLOR_INFOTEXT = 23   'Forecolor of ToolTipText
    Const COLOR_INFOBK = 24     'BackColor of ToolTipText
    Dim lForeColor
    Dim lBackColor
    
    Private Sub Form_Load()
    
        'Get the current colour of the ToolTipText and Background
        lForeColor = GetSysColor(COLOR_INFOTEXT)
        lBackColor = GetSysColor(COLOR_INFOBK)
        'Change the ForeColour to Green
        SetSysColors 1, COLOR_INFOTEXT, vbGreen
        'Change the BackColour to Blue
        SetSysColors 1, COLOR_INFOBK, vbBlue
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    
        'When the Form unloads, change the colours back to the original colours
        SetSysColors 1, COLOR_INFOTEXT, lForeColor
        SetSysColors 1, COLOR_INFOBK, lBackColor
        
    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