CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2010
    Posts
    4

    Multicolored background of a rich text box control (Windows-Form)

    Dear C#-experts,

    I have to implement a Windows form containing a rich text box control with multicoloured text (the first request) and multicoloured back color of this control (the second request). For example: The background of the left part has to be colored light green and of the right part has to be colored light yellow. In addition the displayed text has also to be multicoloured.

    My problem now is to get a multicoloured back color for the rich text box as described above.

    My idea was to use two panel controls with different back colors. The left panel control simulates the left background part and the right one the right background part of the rich text box control. Then I put the rich text box behind both panels.

    Now I can see a multicolored area inside my Windows form, but the content of the text box is hidden by the panel controls. Is there a possibility to get the back color of both panel controls transparent to be able to see the text contained in the rich text box control?

    Or am I totally wrong and should use other controls to get a multicolored background?

    (MS C# 2008 Express, Windows-Application)

    Many thanks in advance!!

    Paula

  2. #2
    Join Date
    Jul 2010
    Posts
    82

    Re: Multicolored background of a rich text box control (Windows-Form)

    Try using FLowLayoutPanel where you can create controls and add it to that at runtime, say from left to right or top to bottom. So you create a panel and then set its color, add it. Then add your textbox, and then add a pael with another color which will be in its right.

    In the text, individual, characters can be selected and set font\color using the RTF Select(). If you want the text to be multi-colored like rainbow colors, you may have to check for third part controls.

    Regards,
    CT.

    Check out www.cuteassistant.com - Manage your tasks, take notes, securely store data and more!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured