酒杯上的碟
>begin
Result.Top := aTop;
Result.Left := aLeft;
Result.Width := aWidth;
Result.Height := aHeight;
Result.Caption := aCaption;
Result.Color := aColor;
end;
{ TCalculator }
constructor TCalculator.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
SetBounds(0,0,250,200);
FMemoryValue := 0;
FCurrentValue := 0;
FLastValue := 0;
FRepeatValue := 0;
BorderStyle := bsRaisedPanel;
BuildCalc;
end;
procedure TCalculator.BuildCalc;
var
i: TButtonType;
begin
Btns[bt7] := ButtonRecord(70, 48, 36, 29, '7');
Btns[bt4] := ButtonRecord(102, 48, 36, 29, '4');
Btns[bt1] := ButtonRecord(134, 48, 36, 29, '1');
Btns[bt0] := ButtonRecord(166, 48, 36, 29, '0');
Btns[bt8] := ButtonRecord(70, 88, 36, 29, '8');
Btns[bt5] := ButtonRecord(102, 88, 36, 29, '5');
Btns[bt2] := ButtonRecord(134, 88, 36, 29, '2');
Btns[btPlusMinus] :=
ButtonRecord(166, 88, 36, 29, '+/-');
Btns[bt9] := ButtonRecord(70, 128, 36, 29, '9');
Btns[bt6] := ButtonRecord(102, 128, 36, 29, '6');
Btns[bt3] := ButtonRecord(134, 128, 36, 29, '3');
Btns[btDecimal] := ButtonRecord(166, 128, 36, 29, '.');
Btns[btDivide] := ButtonRecord(70, 168, 36, 29, '/');
Btns[btMultiply] := ButtonRecord(102, 168, 36, 29, '*');
Btns[btSubtract] := ButtonRecord(134, 168, 36, 29, '-');
Btns[btAdd] := ButtonRecord(166, 168, 36, 29, '+');
Btns[btBackspace] :=
ButtonRecord(37, 49, 63, 25, 'Backspace');
Btns[btClear] := ButtonRecord(37, 115, 63, 25, 'CE');
Btns[btClearAll] := ButtonRecord(37, 181, 63, 25, 'C');
Btns[btsqrt] := ButtonRecord(70, 208, 36, 29, 'sqrt');
Btns[btPercent] := ButtonRecord(102, 208, 36, 29, '%');
Btns[btInverse] := ButtonRecord(134, 208, 36, 29, '1/x');
Btns[btEquals] := ButtonRecord(166, 208, 36, 29, '=');
Btns[btMemoryAdd] := ButtonRecord(166, 5, 36, 29, 'M+');
Btns[btMemoryStore] :=
ButtonRecord(134, 5, 36, 29, 'MS');
Btns[btMemoryRecall] :=
ButtonRecord(102, 5, 36, 29, 'MR');
Btns[btMemoryClear] := ButtonRecord(70, 5, 36, 29, 'MC
for i := Low(TButtonType) to High(TButtonType) do
with TButton.Create(Self) do
begin
Parent := Self;
SetBounds(Btns[i].Left, Btns[i].Top, Btns[i].Width,
Btns[i].Height);
Caption := Btns[i].Caption;
Color := Btns[i].Color;
OnClick := Calc;
Tag := Ord(i);
end;
FStatus : 《酒杯上的碟(第5页)》
本文链接地址:http://www.oyaya.net/fanwen/view/173009.html
Result.Top := aTop;
Result.Left := aLeft;
Result.Width := aWidth;
Result.Height := aHeight;
Result.Caption := aCaption;
Result.Color := aColor;
end;
{ TCalculator }
constructor TCalculator.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
SetBounds(0,0,250,200);
FMemoryValue := 0;
FCurrentValue := 0;
FLastValue := 0;
FRepeatValue := 0;
BorderStyle := bsRaisedPanel;
BuildCalc;
end;
procedure TCalculator.BuildCalc;
var
i: TButtonType;
begin
Btns[bt7] := ButtonRecord(70, 48, 36, 29, '7');
Btns[bt4] := ButtonRecord(102, 48, 36, 29, '4');
Btns[bt1] := ButtonRecord(134, 48, 36, 29, '1');
Btns[bt0] := ButtonRecord(166, 48, 36, 29, '0');
Btns[bt8] := ButtonRecord(70, 88, 36, 29, '8');
Btns[bt5] := ButtonRecord(102, 88, 36, 29, '5');
Btns[bt2] := ButtonRecord(134, 88, 36, 29, '2');
Btns[btPlusMinus] :=
ButtonRecord(166, 88, 36, 29, '+/-');
Btns[bt9] := ButtonRecord(70, 128, 36, 29, '9');
Btns[bt6] := ButtonRecord(102, 128, 36, 29, '6');
Btns[bt3] := ButtonRecord(134, 128, 36, 29, '3');
Btns[btDecimal] := ButtonRecord(166, 128, 36, 29, '.');
Btns[btDivide] := ButtonRecord(70, 168, 36, 29, '/');
Btns[btMultiply] := ButtonRecord(102, 168, 36, 29, '*');
Btns[btSubtract] := ButtonRecord(134, 168, 36, 29, '-');
Btns[btAdd] := ButtonRecord(166, 168, 36, 29, '+');
Btns[btBackspace] :=
ButtonRecord(37, 49, 63, 25, 'Backspace');
Btns[btClear] := ButtonRecord(37, 115, 63, 25, 'CE');
Btns[btClearAll] := ButtonRecord(37, 181, 63, 25, 'C');
Btns[btsqrt] := ButtonRecord(70, 208, 36, 29, 'sqrt');
Btns[btPercent] := ButtonRecord(102, 208, 36, 29, '%');
Btns[btInverse] := ButtonRecord(134, 208, 36, 29, '1/x');
Btns[btEquals] := ButtonRecord(166, 208, 36, 29, '=');
Btns[btMemoryAdd] := ButtonRecord(166, 5, 36, 29, 'M+');
Btns[btMemoryStore] :=
ButtonRecord(134, 5, 36, 29, 'MS');
Btns[btMemoryRecall] :=
ButtonRecord(102, 5, 36, 29, 'MR');
Btns[btMemoryClear] := ButtonRecord(70, 5, 36, 29, 'MC
');
for i := Low(TButtonType) to High(TButtonType) do
with TButton.Create(Self) do
begin
Parent := Self;
SetBounds(Btns[i].Left, Btns[i].Top, Btns[i].Width,
Btns[i].Height);
Caption := Btns[i].Caption;
Color := Btns[i].Color;
OnClick := Calc;
Tag := Ord(i);
end;
FStatus : 《酒杯上的碟(第5页)》