File: paintbox.inc

package info (click to toggle)
lazarus 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 275,760 kB
  • sloc: pascal: 2,341,904; xml: 509,420; makefile: 348,726; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (56 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (3)
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
{%MainUnit ../extctrls.pp}

{ TPaintBox

 *****************************************************************************
  This file is part of the Lazarus Component Library (LCL)

  See the file COPYING.modifiedLGPL.txt, included in this distribution,
  for details about the license.
 *****************************************************************************
}

constructor TPaintBox.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  ControlStyle := ControlStyle + [csReplicatable];
  with GetControlClassDefaultSize do
    SetInitialBounds(0, 0, CX, CY);
end;

class procedure TPaintBox.WSRegisterClass;
begin
  inherited WSRegisterClass;
  RegisterPaintBox;
end;

procedure TPaintBox.Paint;
begin
  if csDesigning in ComponentState then begin
    with Canvas do
    begin
      Pen.Style := psDash;
      Pen.Color := clBlack;
      Brush.Color := Self.Color;
      Brush.Style := bsClear;
      Rectangle(0, 0, Self.Width, Self.Height);
      Line(0,0,Self.Width,Self.Height);
      Line(0,Self.Height-1,Self.Width-1, 0);
//      Line(Self.Width-1,0,-1,Self.Height);
    end;
    exit;
  end;
  if Assigned(OnPaint) then begin
    Canvas.Font := Font;
    Canvas.Brush.Color := Color;
    inherited Paint;
  end;
end;

class function TPaintBox.GetControlClassDefaultSize: TSize;
begin
  Result.CX := 105;
  Result.CY := 105;
end;

// included by extctrls.pp