Results 1 to 4 of 4

Thread: Anyone Have any Idea of changing the Enabled Colour??

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    39

    Question

    Anyone Have any Idea of changing the Enabled Colour??

    The default of the text being enabled is gray.Is it possible to change the Text colour when TextBox.Enabled is issued?

    Please Advice... Thanks
    ThOmaS TaN

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Italy
    Posts
    90

    All you need is Form2

    All you need to manage buttons colors is Microsoft Form2 Object library; if you cannote manage all the aspects with this, then you'll have to use images, one for the enabled status and one for the disabled one.

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    If all you want to do is to change the color of the text to red for example then do the following:
    1) In the form Load event set Text1.ForeColor = vbRed (you could also of course do this by changing the control's font color at design time).
    2) When you disable the textbox set Text1.ForeColor = vbBlack, and
    3) Set it back to red when you enable it.

  4. #4
    Guest
    The default of the text being enabled is gray
    Gray? Do you mean change the disabled text? (rather than enabled text). If so, use the following code.

    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_GRAYTEXT = 17
    Dim lForeColor
    
    Private Sub Form_Load()
    
        'Get the current colour of the Grayed text
        lForeColor = GetSysColor(COLOR_GRAYTEXT)
        'Change it to blue
        SetSysColors 1, COLOR_GRAYTEXT, 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_GRAYTEXT, lForeColor
        
    End Sub
    When you load the Form, it will change the Disabled colour to blue and when you unload the Form it will change them back to the original settings.


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