Solved

Toutline, TDrawGrid

Posted on 1997-03-15
3
205 Views
Last Modified: 2010-04-03
Do you know how I can make my own onDrawItem, onDrawCell resp. for a Toutline or a TDrawGrid. I've been trying to get bitmaps in both, and change the fonts per item in the Toutline but it doesn't come out right.
Thanks for any hint or example program,
Jan-Willem
0
Comment
Question by:jwk031597
  • 2
3 Comments
 
LVL 3

Expert Comment

by:sperling
ID: 1334834
Not sure about what you're asking... Is the problem how to draw in the OnDrawItem, OnDrawCell events?




0
 

Author Comment

by:jwk031597
ID: 1334835
Dear sperling,
Thanks for reading my question. The problem is how to draw in the Draw events. I know that's what they're there for, but when I try, either the drawing disappears immediately after drawing, or it isn't drawn at all. Besides that, I can find no examples on Internet where someone has used the Draw-events.
For the Toutline I've come quite close, but I can't seem to combine my drawings with the tree-structure.
0
 
LVL 3

Accepted Solution

by:
sperling earned 200 total points
ID: 1334836
Okie...

Here's some sample code which works for me...



procedure TForm1.DrawGrid1DrawCell(Sender: TObject; Col, Row: Longint;
  Rect: TRect; State: TGridDrawState);
begin
  DrawGrid1.Canvas.TextRect(Rect, Rect.Left, Rect.Top, 'XXX');
end;

Rect is the Rectangle within you should draw.
Col and Row are the column and row of the grid which you should draw.
State is a set of values indicating whether the drawgrid hasd focus or not, if the cell you're about to draw is selected, fixed and so on.


procedure TForm1.Outline1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  Outline1.Canvas.TextRect(Rect, Rect.Left, Rect.Top, 'XXX');
end;

Rect is again the rectangle within which you should draw.

Index is the index of the Outline1.Lines which you should draw.

State indicates whether the Outline is focused or not, whether the item you're about to draw is enabled, checked, selected and so on.

The outline must have property Style set to otOwnerDraw.


Still, I'm not sure what the problem is. If this doesn't fix it, please leave a comment where you explain in some more detail what you want to do, and some code showing me what you have done.


Regards,

Erik.

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question