RunPc文章範例程式 |
尚未結案
|
cyl
中階會員 發表:163 回覆:171 積分:66 註冊:2002-07-11 發送簡訊給我 |
|
cyl
中階會員 發表:163 回覆:171 積分:66 註冊:2002-07-11 發送簡訊給我 |
unit message; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
CAR_BASE = $BD00;
CAR_PRANGE1 =CAR_BASE 1;
pTaxArray :array[1..22] of Integer=(1620,2160,4320,7120,11230,15210,28220,46170,69690,117000,151200,900,1200,2160,3060,6480,9900,16380,24300,33660,44460,56700) ;
iCCArray :array[1..11] of Integer=(500,599,1199,1799,2399,2999,4199,5399,6599,7799,7800);
bOffest=11;
type
TForm1 = class(TForm)
cbtaxkind: TEdit;
Button1: TButton;
edtcc: TEdit;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations } public
{ Public declarations }
procedure CARPARANGE1(var Message :TMessage);message CAR_PRANGE1;
function ShowTax(iTax :Integer):Integer;
function GetCarRange(const iCC :Integer):integer;
procedure DoMethod2;
end; var
Form1: TForm1; implementation
procedure TForm1.CARPARANGE1(var Message :TMessage);
begin
showTax(PTaxArray[Message.Msg - CAR_BASE]);
end;
function TForm1.ShowTax(iTax :Integer):Integer;
begin
self.Edit1.text:=inttostr(iTax);
Result := iTax;
end;
function TForm1.GetCarRange(const iCC :Integer):integer;
var idx :Integer;
begin
idx:=1;
while (iCC>iCCArray[idx]) do
Inc(idx);
result :=CAR_BASE idx;
end;
procedure Tform1.DoMethod2 ;
begin
if (Self.cbtaxkind.Text ='自用') then
SendMessage(Self.Handle ,GetCarRange(StrToInt(edtCC.Text)),0,0)
else
SendMessage(Self.Handle ,GetCarRange(StrToInt(edtCC.Text)) bOffest,0,0) end;
{$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
begin
DoMethod2() ;
end; end. 我自己寫的,但是只有500cc計算的出來,請問程式碼哪裡寫錯了???
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |