Solved

Toutline, TDrawGrid

Posted on 1997-03-15
3
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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