| 12
 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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 
 | unit PanelBoxRu;
 
interface
 
uses
  Windows, SysUtils, Classes, Controls, StdCtrls ,ExtCtrls, Graphics, Math, Grids, StrUtils, dialogs, Messages;
 
type
  TPanelBoxRu = class(TCustomPanel)
  private
    { Déclarations }
    fStartColor    : Tcolor;
    fEndColor      : Tcolor;
    fCheckBox      : TCheckBox;
    procedure SetCheckBox(value: TCheckBox);
    procedure SetStartColor(value: TColor);
    procedure SetEndColor(value: Tcolor);
  protected
    { Déclarations protégées }
    procedure Paint; override;
    procedure WMMOUSEWHEEL(var Message: TMessage); message WM_MOUSEWHEEL;
 
  public
    { Déclarations publiques }
    constructor Create(AOwner : TComponent); override;
    destructor Destroy; override;
    procedure invalidate; override;
  published
    { Déclarations publiées }
    property Caption;
    property StartColor    : Tcolor read fStartColor write SetStartColor;
    property EndColor      : Tcolor read fEndColor write SetEndColor;
    property CheckBox      : TCheckBox read fCheckBox write SetCheckBox;
 
    property Align;
    property Alignment;
    property Anchors;
    property AutoSize;
    property BevelEdges;
    property BevelInner;
    property BevelKind;
    property BevelOuter;
    property BevelWidth;
    property BiDiMode;
    property BorderWidth;
    property BorderStyle;
    property Color;
    property Constraints;
    property Ctl3D;
    property UseDockManager default True;
    property DockSite;
    property DoubleBuffered;
    property DragCursor;
    property DragKind;
    property DragMode;
    property Enabled;
    property FullRepaint;
    property Font;
    property Locked;
    property Padding;
    property ParentBiDiMode;
    property ParentBackground;
    property ParentColor;
    property ParentCtl3D;
    property ParentDoubleBuffered;
    property ParentFont;
    property ParentShowHint;
    property PopupMenu;
    property ShowCaption;
    property ShowHint;
    property TabOrder;
    property TabStop;
    property VerticalAlignment;
    property Visible;
    property OnAlignInsertBefore;
    property OnAlignPosition;
    property OnCanResize;
    property OnClick;
    property OnConstrainedResize;
    property OnContextPopup;
    property OnDockDrop;
    property OnDockOver;
    property OnDblClick;
    property OnDragDrop;
    property OnDragOver;
    property OnEndDock;
    property OnEndDrag;
    property OnEnter;
    property OnExit;
    property OnGetSiteInfo;
    property OnMouseActivate;
    property OnMouseDown;
    property OnMouseEnter;
    property OnMouseLeave;
    property OnMouseMove;
    property OnMouseUp;
    property OnResize;
    property OnStartDock;
    property OnStartDrag;
    property OnUnDock;
 
  end;
 
procedure Register;
 
implementation
 
 
constructor TPanelBoxRu.Create(AOwner : TComponent);
begin
  inherited Create(AOwner);
  Parent := AOwner as TWinControl;
  fStartColor := clCream;
  fEndColor   := clBtnFace;
  fCheckBox   := TCheckBox.Create(Self);
  With fcheckBox do
  begin
    Parent   := Self;
    Caption := 'Salut les loups c''est Buzz';
    Left      := 2;
    Top      := 2;
  end;
end;
 
 
destructor TPanelBoxRu.Destroy;
begin
  fCheckBox.Free;
  inherited Destroy;
end;
 
procedure TPanelBoxRu.invalidate;
var
  i: Integer;
begin
  inherited InValidate;
    for i := 0 to ControlCount - 1 do
      Controls[i].Invalidate;
end;
 
procedure TPanelBoxRu.SetCheckBox(value: TCheckBox);
begin
  fCheckBox.assign(value);
end;
 
procedure TPanelBoxRu.SetEndColor(value: Tcolor);
begin
  if Value <> fEndColor then
  begin
    fEndColor := Value;
    Invalidate;
  end;
end;
 
procedure TPanelBoxRu.SetStartColor(value: TColor);
begin
  if Value <> fStartColor then
  begin
    fStartColor := Value;
    Invalidate;
  end;
end;
 
procedure TPanelBoxRu.Paint;
  procedure Degrader;
  var
    Vertex    :array[0..1] of TTriVertex;
    Rectangle :TGradientRect;
 
  begin
    Vertex[0].X     := 0;
    Vertex[0].Y     := 0;
    Vertex[0].Red   := GetRValue(StartColor) *$100;
    Vertex[0].Green := GetGValue(StartColor) *$100;
    Vertex[0].Blue  := GetBValue(StartColor) *$100;
 
    Vertex[1].X     := Width ;
    Vertex[1].Y     := Height;
    Vertex[1].Red   := GetRValue(EndColor) *$100;
    Vertex[1].Green := GetGValue(EndColor) *$100;
    Vertex[1].Blue  := GetBValue(EndColor) *$100;
 
    Rectangle.UpperLeft  := 0;
    Rectangle.LowerRight := 1;
 
    GradientFill(Canvas.Handle, @Vertex, 2, @Rectangle, 1, GRADIENT_FILL_RECT_V);
  end;
begin
  inherited Paint;
  Degrader;
end;
 
procedure Register;
begin
  RegisterComponents('RuCompos', [TPanelBoxRu]);
end;
 
end. |