Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem setting RichTextEdit BackColor

Status
Not open for further replies.

Statey603

Programmer
Nov 10, 2009
196
US
I am working on existing code. I am trying to programmatically set the BackColor for a RichTextEdit control at runtime and cannot seem to get it to work.

In the Layout designer, the BackColor is set to 'Window Background' via the dropdown selection on the General Properties Tab.

Code in the open() function sets the BackColor to Gray / ButtonFace via rte.BackColor = RGB(217,213,206). This works fine.

I am adding functionality to allow certain user roles to be able to make edits to the text in the RichTextEdit control and I want to set the BackColor back to the Window Background color when they can edit.

Are there predefined constants that define system color values like 'Window Background' so they can easily be referenced during code execution?

I have tried setting the RichTextEdit BackColor to WHITE via rte.BackColor = RGB(255,255,255) but the color does not change.

I appreciate any assistance on how to programmatically change the BackColor of a RichTextEdit and any limitations.
 
>Are there predefined constants that define system color values like 'Window Background' so they can easily be referenced during code execution?

if I'm not wrong 'Yes' (it's just long number value):
---
-export your object to a file
-change the color in design mode
-export the object to another file
-do a fc.exe of both files: It'll show you what attributes are to be changed by code and with what values.

>I have tried setting the RichTextEdit BackColor to WHITE via rte.BackColor = RGB(255,255,255) but the color does not change.

-just guessing no pb installed on pc ...
-try to move the focus away from the control before changing
-is there some opaque attribute (transparency)?
-is the rte enabled?

hope it helps

regards,
Miguel L.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top