P
plf22
Unregistered / Unconfirmed
GUEST, unregistred user!
请问在Delphi中怎样对十六进制的数据进行位操作,比如移位操作,以及十六进制的数怎么表示
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Inf: LongInt;
mo: array[0..3] of LongInt;
I: Byte;
PLabel: ^TLabel;
begin
mo[0] := 1;
mo[1] := 2;
mo[2] := 3;
mo[3] := 4;
New(PLabel);
PLabel := @Label1;
for I := 0 to 3 do
begin
Inf := mo[I]
//Inf要初始始化吗?你没有啊
Inf := Inf or mo[I];
if I <> 0 then
Inf := Inf shl 8;
PLabel^.Caption := IntToStr(Inf);
Inc(PLabel);
end;
end;
end.