Solved

Toutline, TDrawGrid

Posted on 1997-03-15
3
200 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 112
How to define IfThen functions in one common unit? 4 54
how to resize animated Gif image in delphi ? 1 31
CheckListBox usage 3 59
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

832 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