You've already forked lazarus-ccr
jvcllaz: Improved layout of TJvTMTimeLine demo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6623 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -207,7 +207,7 @@ begin
|
||||
else
|
||||
JvTimeLine1.Images := Images_200;
|
||||
JvTimeLine1.Align := alClient;
|
||||
JvTimeLine1.Constraints.MinHeight := Scale96ToFont(60);
|
||||
JvTimeLine1.Constraints.MinHeight := Scale96ToFont(64);
|
||||
JvTimeLine1.Hint :=
|
||||
'Double-click a date to edit it''s memo content.' +
|
||||
LineEnding +
|
||||
@ -219,14 +219,10 @@ begin
|
||||
udButtonWidth.Position := JvTimeLine1.ButtonWidth;
|
||||
chkReadOnly.Checked := JvTimeLine1.ReadOnly;
|
||||
lbObjFontStyle.Checked[2] := true;
|
||||
|
||||
LblKeyboardNavigation.Font.Style := [fsBold];
|
||||
|
||||
h := abs(Screen.SystemFont.Height);
|
||||
for i := 0 to JvTimeLine1.Images.Count - 1 do
|
||||
LbImages.Items.Add(IntToStr(i));
|
||||
LbImages.ItemHeight := Max(JvTimeLine1.Images.Height, h + 2 * Scale96ToFont(IMAGE_DIST));
|
||||
LbImages.Width := JvTimeLine1.Images.Width + 2* h + 2 * Scale96ToFont(IMAGE_DIST);
|
||||
|
||||
Statusbar.Panels[0].Width := Scale96ToFont(120);
|
||||
Statusbar.Panels[1].Width := Scale96ToFont(220);
|
||||
@ -412,7 +408,7 @@ var
|
||||
h: Integer;
|
||||
begin
|
||||
LbImages.Canvas.Font.Assign(LbImages.Font);
|
||||
h := LbImages.Canvas.TextHeight('Tg');
|
||||
h := LbImages.Canvas.TextHeight('99');
|
||||
if State * [odSelected, odFocused] <> [] then begin
|
||||
LbImages.Canvas.Brush.Color := clHighlight;
|
||||
LbImages.Canvas.font.Color := clHighlightText;
|
||||
@ -421,14 +417,14 @@ begin
|
||||
LbImages.Canvas.Font.Color := clWindowText;
|
||||
end;
|
||||
LbImages.Canvas.FillRect(ARect);
|
||||
InflateRect(ARect, -IMAGE_DIST, 0);
|
||||
InflateRect(ARect, -Scale96ToFont(IMAGE_DIST), 0);
|
||||
JvTimeLine1.Images.Draw(
|
||||
LbImages.Canvas, ARect.Left,
|
||||
(ARect.Top + ARect.Bottom - JvTimeLine1.Images.Height) div 2,
|
||||
Index
|
||||
);
|
||||
LbImages.Canvas.TextOut(
|
||||
ARect.Left + JvTimeLine1.Images.Width + IMAGE_DIST,
|
||||
ARect.Left + JvTimeLine1.Images.Width + Scale96ToFont(IMAGE_DIST),
|
||||
(ARect.Top + ARect.Bottom - h) div 2,
|
||||
IntToStr(Index)
|
||||
);
|
||||
@ -442,7 +438,13 @@ begin
|
||||
end;
|
||||
|
||||
procedure TTMTimeLineMainForm.FormShow(Sender: TObject);
|
||||
var
|
||||
ex: TSize;
|
||||
begin
|
||||
ex := LbImages.Canvas.TextExtent('99');
|
||||
LbImages.ItemHeight := Max(JvTimeLine1.Images.Height, ex.CY + 2 * Scale96ToFont(IMAGE_DIST));
|
||||
LbImages.ClientWidth := JvTimeLine1.Images.Width + ex.CX + 3 * Scale96ToFont(IMAGE_DIST);
|
||||
|
||||
Constraints.MinWidth := GbDates.Left + GbDates.Width;
|
||||
AutoSize := true;
|
||||
AutoSize := false;
|
||||
|
@ -496,7 +496,7 @@ begin
|
||||
end;
|
||||
FLeftBtn.SetSubComponent(True);
|
||||
FRightBtn.SetSubComponent(True);
|
||||
Height := 56;
|
||||
Height := 64;
|
||||
BevelInner := bvNone;
|
||||
BevelOuter := bvNone;
|
||||
Color := clWindow;
|
||||
@ -660,6 +660,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TJvCustomTMTimeline.DrawDates(ACanvas: TCanvas);
|
||||
const
|
||||
TOP_MARGIN = 2;
|
||||
var
|
||||
I, FirstOffset: Integer;
|
||||
Y, M, D: Word;
|
||||
@ -668,6 +670,7 @@ var
|
||||
S: string;
|
||||
FTmpStyle: TFontStyles;
|
||||
AContinue: Boolean;
|
||||
h: Integer;
|
||||
begin
|
||||
AContinue := True;
|
||||
// DoBeforeDraw(ACanvas);
|
||||
@ -679,15 +682,15 @@ begin
|
||||
FirstOffset := 1;
|
||||
// first loop: draw dates, today and images
|
||||
FTmpStyle := Font.Style;
|
||||
h := Canvas.TextHeight('Tg');
|
||||
for I := 0 to Width div DayWidth do
|
||||
begin
|
||||
R := GetRectForDate(Self.Date + I);
|
||||
if Self.Date + I = SysUtils.Date then
|
||||
DrawToday(ACanvas, R);
|
||||
|
||||
DecodeDate(Self.Date + I, Y, M, D);
|
||||
R := Classes.Rect(I * DayWidth, 8, I * DayWidth + DayWidth, Font.Size+8);
|
||||
OffsetRect(R, FirstOffset, 0);
|
||||
R := Classes.Rect(I * DayWidth, 0, I * DayWidth + DayWidth, h);
|
||||
OffsetRect(R, FirstOffset, TOP_MARGIN);
|
||||
S := Format('%.2d', [D]);
|
||||
SetBkMode(ACanvas.Handle, TRANSPARENT);
|
||||
if Objects[Self.Date + I] <> nil then
|
||||
|
Reference in New Issue
Block a user