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. selected text in a Edit Box

selected text in a Edit Box

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
5 Posts 3 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.
  • S Offline
    S Offline
    Shuang Wu
    wrote on last edited by
    #1

    how to chang the foreground/background color of selected text in a Edit Box? Hello World

    A D 2 Replies Last reply
    0
    • S Shuang Wu

      how to chang the foreground/background color of selected text in a Edit Box? Hello World

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      selected text??? Well you can handle WM_CTLCOLOREDIT which will change the color of all your text and background inside the edit, which I think might change your selection color (if selection is drawn using an XOR) Actually I think those colors are stored in GetSysColor() so I think your out of luck without resorting to subclassing it's WM_PAINT message...however be forewarned...from personal experience...WM_PAINT is not the only place edit controls draw from...atleast it seemed to me :) They paint inside WM_CHAR and everything...it's really quite annoying... p.s-You could maybe intercept the selection of an edit control (using a hi-res timer to repeat check if selection has changed and if it has) change the global settings of foregroudn and text selection colors. This should work because only a single control can have focus at any given time...then when your done with the control return colors back to default. Cheers :) How do I print my voice mail?

      S 1 Reply Last reply
      0
      • A alex barylski

        selected text??? Well you can handle WM_CTLCOLOREDIT which will change the color of all your text and background inside the edit, which I think might change your selection color (if selection is drawn using an XOR) Actually I think those colors are stored in GetSysColor() so I think your out of luck without resorting to subclassing it's WM_PAINT message...however be forewarned...from personal experience...WM_PAINT is not the only place edit controls draw from...atleast it seemed to me :) They paint inside WM_CHAR and everything...it's really quite annoying... p.s-You could maybe intercept the selection of an edit control (using a hi-res timer to repeat check if selection has changed and if it has) change the global settings of foregroudn and text selection colors. This should work because only a single control can have focus at any given time...then when your done with the control return colors back to default. Cheers :) How do I print my voice mail?

        S Offline
        S Offline
        Shuang Wu
        wrote on last edited by
        #3

        emmm... it looks a bit complex. i will take your constructive advice. While, a great thanks.;) Hello World

        A 1 Reply Last reply
        0
        • S Shuang Wu

          emmm... it looks a bit complex. i will take your constructive advice. While, a great thanks.;) Hello World

          A Offline
          A Offline
          alex barylski
          wrote on last edited by
          #4

          It'll pose for an interesting challenge... How do I print my voice mail?

          1 Reply Last reply
          0
          • S Shuang Wu

            how to chang the foreground/background color of selected text in a Edit Box? Hello World

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            This article indirectly shows how to do that.


            "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

            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