CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2014
    Posts
    9

    Change Combo1 color

    how to chage the color (back + button) of a combo1 ? any suggestion ... ?
    Last edited by javabill; June 19th, 2014 at 02:17 PM.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Change Cobo1 color

    Here's a LISTVIEW, but it should be similar:

    Code:
    Option Explicit
    
    Private Sub Form_Load()
        ListView1.FullRowSelect = True
        ListView1.View = lvwReport
        Dim itmX As ListItem ' Create a variable to add ListItem objects.
        Dim clmX As ColumnHeader ' Create an object variable for the ColumnHeader object.
       ' Add ColumnHeaders.
        Set clmX = ListView1.ColumnHeaders.Add(, , "Column 1", ListView1.Width / 3)
        Set clmX = ListView1.ColumnHeaders.Add(, , "Column 2", ListView1.Width / 3)
        Set clmX = ListView1.ColumnHeaders.Add(, , "Column 3", ListView1.Width / 3)
        
        ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.
        ListView1.View = lvwReport ' Set View property to Report.
        
        ' Add a main item
        Set itmX = ListView1.ListItems.Add(, , "First value")
        ' Add two subitems for that item
        itmX.SubItems(1) = "First value subitem 1"
        itmX.SubItems(2) = "First value subitem 2"
    
        ' Add another main item
        Set itmX = ListView1.ListItems.Add(, , "Second value")
        ' Add two subitems for that item
        itmX.SubItems(1) = "Second value subitem 1"
        itmX.SubItems(2) = "Second value subitem 2"
        
        ' Add another main item
        Set itmX = ListView1.ListItems.Add(, , "Third value")
        ' Add two subitems for that item
        itmX.SubItems(1) = "Third value subitem 1"
        itmX.SubItems(2) = "Third value subitem 2"
        
        ReDim Preserve clr(ListView1.ListItems.Count)
        'Initialise the subclassing
        g_MaxItems = ListView1.ListItems.Count - 1
        g_addProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
      SetWindowLong hWnd, GWL_WNDPROC, g_addProcOld
    End Sub
    
    Private Sub ListView1_Click()
      If ListView1.SelectedItem.Index < 0 Then Exit Sub
      SetLIBackColor ListView1, ListView1.SelectedItem.Index, vbRed
    End Sub
    Not easy, anyways...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jan 2014
    Posts
    9

    Re: Change Cobo1 color

    well... i will try...

    thanks a lot

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

Featured