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. Change Background color of selected text?

Change Background color of selected text?

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.
  • I Offline
    I Offline
    irshad_bukhari
    wrote on last edited by
    #1

    How to change the background color selected text from black to diffrent color in richeditctrl.

    D 1 Reply Last reply
    0
    • I irshad_bukhari

      How to change the background color selected text from black to diffrent color in richeditctrl.

      D Offline
      D Offline
      Dominik Reichl
      wrote on last edited by
      #2

      See the CHARFORMAT2 structure and the EM_SETCHARFORMAT message in MSDN. Best regards, :) Dominik


      CHARFORMAT2 [This is preliminary documentation and subject to change.] The CHARFORMAT2 structure contains information about character formatting in a rich edit control. CHARFORMAT2 is a rich edit 2.0 extension of the CHARFORMAT structure. Rich edit 2.0 allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages. typedef struct _charformat2 { UINT cbSize; _WPAD _wPad1; DWORD dwMask; DWORD dwEffects; LONG yHeight; LONG yOffset; COLORREF crTextColor; BYTE bCharSet; BYTE bPitchAndFamily; WCHAR szFaceName[LF_FACESIZE]; _WPAD _wPad2; WORD wWeight; SHORT sSpacing; COLORREF crBackColor; LCID lcid; DWORD dwReserved; SHORT sStyle; WORD wKerning; BYTE bUnderlineType; BYTE bAnimation; BYTE bRevAuthor; BYTE bReserved1; } CHARFORMAT2; Members cbSize Specifies the size, in bytes, of this structure. Before passing this structure to a rich edit control, set cbSize to the size of the CHARFORMAT or CHARFORMAT2 structure. If cbSize equals the size of a CHARFORMAT structure, the control uses only the CHARFORMAT members. dwMask Specifies the parts of the CHARFORMAT2 structure that contain valid information. The dwMask member can be a combination of the values from two sets of bit flags. One set indicates the structure members that are valid. Another set indicates the valid attributes in the dwEffects member. Set the following values to indicate the valid structure members. Value Meaning CFM_ANIMATION The bAnimation member is valid. CFM_BACKCOLOR The crBackColor member is valid. CFM_CHARSET The bCharSet member is valid. CFM_COLOR The crTextColor member is valid unless the CFE_AUTOCOLOR flag is set in the dwEffects member. CFM_FACE The szFaceName member is valid. CFM_KERNING The wKerning member is valid. CFM_LCID The lcid member is valid. CFM_OFFSET The yOffset member is valid. CFM_REVAUTHOR The bRevAuthor member is valid. CFM_SIZE The yHeight member is valid. CFM_SPACING The sSpacing member is valid. CFM_STYLE The sStyle member is valid. CFM_UNDERLINETYPE The bUnderlineType member is valid. CFM_WEIGHT The wWeight member is valid. Set the following values to indicate the

      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