帮帮忙,把这段VB代码改成delphi(不懂VB)(50分)

K

kingqc

Unregistered / Unconfirmed
GUEST, unregistred user!
Dim intListIndex As Integer
Dim intSpeed As Integer

'Clear Speeds Combo
cboSpeeds.Clear

'Auto first in the list
cboSpeeds.AddItem "AUTO"

'Set the Item data with zero
cboSpeeds.ItemData(cboSpeeds.NewIndex) = 0
'Start Speeds as 1x
intSpeed = 1

'Spin through supported speeds
do
Until intSpeed > 52

'Show speed as : example '10X'
cboSpeeds.AddItem CStr(intSpeed) &
"X"

'Set the Item data with the actual speed
cboSpeeds.ItemData(cboSpeeds.NewIndex) = intSpeed

'Show multiples of two until we get to eight... then
go in steps of four
If intSpeed <= 4 then
intSpeed = intSpeed * 2
else
intSpeed = intSpeed + 4
End If

Loop

'Set speed to 'AUTO'
cboSpeeds.ListIndex = 0

End Sub
 
var intListIndex:Integer;
intSpeed:Integer;
begin
//'Clear Speeds Combo
cboSpeeds.Items.Clear;
//'Auto first in the list
cboSpeeds.Items.Add("AUTO");
//'Set the Item data with zero
cboSpeeds.ItemIndex: = 0
//'Start Speeds as 1x
intSpeed: = 1
//'Spin through supported speeds
while intSpeed<53do
begin
//Show speed as : example '10X'
cboSpeeds.Items.Add(IntToStr(intSpeed)+'X');

//Set the Item data with the actual speed
cboSpeeds.Itemindex:= intSpeed;
//Show multiples of two until we get to eight... then
go in steps of four
If intSpeed <= 4 then
intSpeed = intSpeed * 2
else
intSpeed = intSpeed + 4
End If

end;

//Set speed to 'AUTO'
cboSpeeds.ItemIndex: = 0
end;
 
var
intListIndex : Integer;
intSpeed : Integer;
begin

'Clear Speeds Combo
cboSpeeds.Items.Clear

'Auto first in the list
cboSpeeds.Items.Add('AUTO');

'Set the Item data with zero
cboSpeeds.Items.Strings[cboSpeeds.ItemIndex] := '0';
'Start Speeds as 1x
intSpeed = 1

'Spin through supported speeds
do


'Show speed as : example '10X'
cboSpeeds.Items.Add(Inttostr(intSpeed)+ 'X');

'Set the Item data with the actual speed
cboSpeeds.Items.Strings[cboSpeeds.ItemIndex] := Inttostr(intSpeed);

'Show multiples of two until we get to eight... then
go in steps of four
If intSpeed <= 4 then
intSpeed := intSpeed * 2
else
intSpeed := intSpeed + 4;


Until intSpeed > 52;

'Set speed to 'AUTO'
cboSpeeds.ItemIndex = 0;

end;
 

Similar threads

I
回复
0
查看
2K
import
I
I
回复
0
查看
3K
import
I
I
回复
0
查看
2K
import
I
I
回复
0
查看
1K
import
I
I
回复
0
查看
2K
import
I
顶部