Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Toutline, TDrawGrid

Posted on 1997-03-15
3
Medium Priority
?
220 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

715 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