Results 1 to 3 of 3

Thread: RichEdit background control color

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    RichEdit background control color

    To change backgound color of a rich edit control area.

    To do it, just send the following message to the richedit control, where lColor is the color number you want to assign to the control:
    [code=thinbasic] sendmessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor[/code]

    An example getting color from standard color dialog:
    [code=thinbasic] lColor = Dialog_ChooseColor(hDlg, rgb(255, 0, 0), %CC_RGBINIT OR %CC_FULLOPEN )
    if lColor <> -1 then
    sendmessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor
    end if[/code]

    Here it is a Microsoft reference page on rich edit notification message list:
    http://windowssdk.msdn.microsoft.com.../ms651298.aspx
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: RichEdit background control color

    Remember that "SendMessage ..." API function has its "CONTROL SEND ..." version.
    For example :
    [code=thinbasic] SendMessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor[/code]
    if the same of
    [code=thinbasic] CONTROL SEND hDlg, %ID_Editor, %EM_SETBKGNDCOLOR, 0, lColor[/code]

    They do exactly the same.
    The difference is that SendMessage needs the internal window handle of the control while CONTROL SEND needs the handle of the window you have created plus your control id.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3

    Re: RichEdit background control color

    Thanks Eros for that.

    SendMessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor
    
    The new RTF functions in latest preview are working great!

    catventure
    http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)

Similar Threads

  1. Vista test: richedit background color
    By ErosOlmi in forum Preview testing
    Replies: 8
    Last Post: 04-09-2008, 22:53

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •