1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| PROCEDURE TBCSNode.Draw( Canvas : TCanvas );
CONST
Dx : Integer = -2;
Dy : Integer = -2;
VAR R : TRect;
x1, y1, x2, y2: Integer;
W, H : Integer;
s : STRING;
c: PChar;
BEGIN
IF Visible THEN
BEGIN
W:=Width;
H:=Height;
x1:=x-W DIV 2;
y1:=y-H DIV 2;
x2:=x1+W;
y2:=y1+H;
WITH Canvas DO
BEGIN
// Ici pour l'ombrage
if FShadow then
Begin
Brush.Color:=clGray;
Pen.Color:=clGray;
CASE FShape OF
stRectangle, stSquare : Rectangle(x1-Dx, y1-Dy, x2-Dx, y2-Dy);
stRoundRect, stRoundSquare : RoundRect(x1-Dx, y1-Dy, x2-Dx, y2-Dy, 16, 16);
stEllipse, stCircle : Ellipse(x1-Dx, y1-Dy, x2-Dx, y2-Dy);
END;
End;
Brush.Color:=clWhite;
Pen.Color:=clBlack;
Brush.Style:=bsSolid;
IF (FColor<>clNone) THEN
Brush.Color:=FColor;
CASE FShape OF
stRectangle, stSquare : Rectangle(x1, y1, x2, y2);
stRoundRect, stRoundSquare : RoundRect(x1, y1, x2, y2, 16, 16);
stEllipse, stCircle : Ellipse(x1, y1, x2, y2);
END;
IF (FName<>'') THEN
BEGIN
c:=PChar(FName);
If FShowAccelChar then
DrawText(Canvas.Handle, c, Length(FName), R, DT_CALCRECT)
Else
DrawText(Canvas.Handle, c, Length(FName), R, DT_CALCRECT or DT_NOPREFIX);
H:=R.Bottom-R.Top;
W:=R.Right-R.Left;
R.Left:=(x1+x2-W) div 2;
R.Right:=R.Left+W;
R.Top:=(y1+y2-H) div 2;
R.Bottom:=R.Top+H;
Brush.Style:=bsClear;
case FTextAlign of
0 : If FShowAccelChar then
DrawText(Canvas.Handle, c, Length(FName), R, DT_LEFT)
Else
DrawText(Canvas.Handle, c, Length(FName), R, DT_LEFT or DT_NOPREFIX);
1 : If FShowAccelChar then
DrawText(Canvas.Handle, c, Length(FName), R, DT_CENTER)
Else
DrawText(Canvas.Handle, c, Length(FName), R, DT_CENTER or DT_NOPREFIX);
2 : If FShowAccelChar then
DrawText(Canvas.Handle, c, Length(FName), R, DT_RIGHT)
Else
DrawText(Canvas.Handle, c, Length(FName), R, DT_RIGHT or DT_NOPREFIX);
else
If FShowAccelChar then
DrawText(Canvas.Handle, c, Length(FName), R, DT_CENTER)
Else
DrawText(Canvas.Handle, c, Length(FName), R, DT_CENTER or DT_NOPREFIX);
end;
END;
END;
END;
END; {* PROC .Draw *} |
Partager