Jump to content
gkobler

TTreeView and CustomDraw

Recommended Posts

I have a problem with my TTreeView Component, i have add my own methode OnCustomDraw

Sender.Canvas.Brush.Color := clGreen;
Sender.Canvas.Rectangle(ARect);
Sender.Canvas.FillRect(ARect);
DefaultDraw := True;

Just to draw a green background for test purpose. This code is working well as a VCL-Form App, but as a nested form from as follow

TYPE
  TMainFrame = CLASS(TFrame)

When i use them in a WelcomePage Plugin, it does not work. It just drawed the white Background, also the Color Property is ignored.

 

Does anybody has a hint for me?

Share this post


Link to post

Can you provide a more complete reproducible example?  Are you suggesting that when your custom TreeView is placed on a TForm then the TreeView shows a green background, but when the TreeView is placed on a TFrame than the TreeView does not show a green background?  Is it only limited to IDE plugins, or do you have the same problem if you use the TFrame in an application?

Edited by Remy Lebeau

Share this post


Link to post

Have created a demo (see attached file). Demo are based on the basic WP demo project.

 

Open the project group TestWPTreeView. When you compile the WP-Plugin, and install it you will see the backgroud are not painted. But when you run the VCL-Program it does.

 

I hope this makes my question clear.

TestWPTreeView.zip

Edited by gkobler

Share this post


Link to post

Could it be related to the VCL style the IDE is using?

 

BTW, you can change the color used for the item background in the BeforeItemErase event. 

Share this post


Link to post
10 minutes ago, Uwe Raabe said:

Could it be related to the VCL style the IDE is using?

OK, a good approach.

 

11 minutes ago, Uwe Raabe said:

BTW, you can change the color used for the item background in the BeforeItemErase event. 

The color is just a test, I want to draw a background and call the following code.

 IF Assigned(BorlandIDEServices) THEN BEGIN
   LColor := (BorlandIDEServices AS IOTAIDEThemingServices).StyleServices.GetSystemColor(Color)
 END ELSE BEGIN
   LColor := clNone;
 END;
 (WelcomePagePluginService AS INTAWelcomePageBackgroundService).PaintBackgroundTo(Sender.Canvas, Sender, LColor, cCaptionOpacity);

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×