Chris Crowe further asked:
> ps: Look at outlook's day view and that is the look I am after.
[ snippage ]
> So from what you are saying..
>
> I must:
>
> 1) Create a region for say #1 above, and draw that.
> 2) Create a region below #1 and draw that.
> 3) Draw the time incrments etc..?
> 4) How do I draw the rows, and the appointments?, since the
> rows must be drawn before the appointment.
Not quite. I'm assuming that the entire day view is one control and I'd draw
as follows:
0. Create a utility method:
procedure TDayPlanner.RepaintedRect(const Rect: TRect);
var
Rgn: HRGN;
begin
if RepaintRgn <> 0 then
begin
Rgn := CreateRectRgnIndirect(Rect);
CombineRgn(FRepaintRgn, FRepaintRgn, Rgn, RGN_DIFF);
DeleteObject(Rgn)
end
end;
1. Create an region containing the entire day view control:
RepaintRgn := CreateRectRegionIndirect(BoundsRect);
2. For every area on the control that is not going to be the background
color draw it somthing like:
TextRect(TextRect, 0, 0, 'Some stuff');
RepaintedRect(TextRect)
or
MoveTo(ColStart - 1, RowHeight);
LineTo(ColStart - 1, FooterStart);
RepaintedRect(Rect(ColStart - 1, RowHeight, ColStart, FooterStart))
or what ever regions need painting in whar ever order makes things look
good.
3. When all the drawing is done you do
FillRgn(Canvas.Handle, RepaintRgn, Canvas.Brush.Handle);
to repaint all the bits that haven't been drawn on so far.
The entire thing can be broken down into small regions for repainting it you
need seperate background colors over large regions, but that's basically the
idea.
In general the concept is to repaint every single pixel in the invalid area
on the assumption that you haven't cleared the area before hand. A good
debugging trick is to paint the entire area in purple, or bright green first
and then look after to see if you have missed any bits.
Cheers, Max.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz