Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Changing the background color of Text control or combo box when text got changed

Changing the background color of Text control or combo box when text got changed

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ashish Ranjan Mishra
    wrote on last edited by
    #1

    How to change the background color of Edit control or combo box only when some one has edited the text of text box or change the slection of combo box? Thanks in advance

    asdasdadadasd

    _ 1 Reply Last reply
    0
    • A Ashish Ranjan Mishra

      How to change the background color of Edit control or combo box only when some one has edited the text of text box or change the slection of combo box? Thanks in advance

      asdasdadadasd

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      Background colors of controls are changed by handling the WM_CTLCOLOR message and returning a brush with the required color. In your case, you also need to check the text in the control and only then return the brush. You would also need to invalidate the control as soon as the edit text or combo selection is changed so that the WM_CTLCOLOR handler gets called.

      «_Superman_»  _I love work. It gives me something to do between weekends.

      _Microsoft MVP (Visual C++)

      Polymorphism in C

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups