Hi
thank you.
1. About the color of the Panel changing, I thought that the text written on canvas will have Panel's background color, so when it changes, the text is still visible, and the background changes. So, I thought it would be 'transparent' area.
Also, I need for this to work even if RichEdit is not actual control (I create it in my code) - in this case line: RC.ClientRect; doesn't compile... I guess because
Sorry, I guess I should have explained in more details. I'm creating a component that will draw the Richedit text and image on Panel. And panel should behave correctly on MouseEnter,MouseLeave,Clic
2. And Image is a bit distorted. Do you have a suggestion how to fix this?
Main Topics
Browse All Topics





by: HypoPosted on 2009-04-20 at 08:56:29ID: 24185801
Hi, this is a crude example of how you can do the things you want. I think it will be enough to get you started with what you want to do.
Create a new application, add one TImage and load it with an image, one TRichEdit, one TPanel and then one TButton. Add the unit RichEdit to your uses-clause, and then insert the code below and connect the events. It's not the most perfect example, but it works for me, and does what you want to do. Changing the color of the TPanel is made by just setting the TPanels color property.
Note: When painting on a canvas as I've done in this example, it will be overwritten when the control is repainted (e.g. when a window is moved over the control). To make your painting persistent, you have to overwride wither WM_PAINT or the paint-method of the control.
regards
Hypo.
Select allOpen in new window