Results 1 to 8 of 8

Thread: [RESOLVED] Change Combbox Edit Box Backcolor

  1. #1

    Thread Starter
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    814

    Resolved [RESOLVED] Change Combbox Edit Box Backcolor

    Hi, I been makeing my own Web Browser for the last few days, Now i thought of idea that when a user goes to a sercure server like https: I like the Combo Box that I type urls into the Edit box to go green, and if the site is just a normal http: I like it to be white, is I know how to get the Hwnd of the edit field but not sure how to set the back color, Hope someone can help, Sorry about my bad spelling.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Change Combbox Edit Box Backcolor

    .BackColor = vbGreen ?!

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Change Combbox Edit Box Backcolor

    If you are making your own browser then why do you need the handle for a combo box you already control?

  4. #4

    Thread Starter
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    814

    Re: Change Combbox Edit Box Backcolor

    The combobox is were I type the address, baja_yu I need to chnage just the edit part of the combobox you know the textbox but the rest of the drop down items will be white.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Change Combbox Edit Box Backcolor

    Changing the Forecolor will change the color of the text, but it will change it for ALL items in the combo.

    Changing the backcolor will change the backcolor of the entire control.

  6. #6

    Thread Starter
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    814

    Re: Change Combbox Edit Box Backcolor

    Code:
    Changing the backcolor will change the backcolor of the entire control.
    Yes umm, maybe my idea was not a good one, I am guessing I will need to subclass the combobox edit box some how?

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Change Combbox Edit Box Backcolor

    Subclassing is the answer. An editable combobox consists of 3 controls: the outer control, an inner textbox, and a listbox for the dropdown. The textbox portion sends its parent (the combobox) a WM_CTLCOLOREDIT message each time it is about to be drawn. If responding to that event, supply a colored brush per documentation
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    814

    Re: Change Combbox Edit Box Backcolor

    Thanks LaVolpe, I thought it require some sort of subclass. I have a look into subclassing it.

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