procedure TForm1.ToolButton10Click(Sender: TObject);
var tembmp:TBitmap;prow:pByteArray;
begin
    if OpenPictureDialog1.Execute then
    begin
          try
            tembmp:=TBitmap.Create;
            tembmp.LoadFromFile(OpenPictureDialog1.FileName);//要读取的图片格式是4位16色的100*150的BMP
            prow:=tembmp.ScanLine[0];//这读取的是第一行还是最后一行?
            Memo1.Lines.Add(……);//这里怎么把prow的内存16进制的数据显示出来呢?就像OD的那样:00 00 FF ……
          finally
            tembmp.Free;
          end;                                  
    end;
end;

解决方案 »

  1.   

    逐个的将byte数组中的item转换为16进制字符串,用IntToHex
      

  2.   

    for i := 0 to tembmp.Width-1 do
      begin
        Memo1.Lines.Text := Memo1.Lines.Text + IntToHex((prow[i]),2);
      end;
      

  3.   


    var
      tembmp:TBitmap;prow:pByteArray;
      i:Integer;
    begin
        if OpenPictureDialog1.Execute then
        begin
              try
                tembmp:=TBitmap.Create;
                tembmp.LoadFromFile(OpenPictureDialog1.FileName);//要读取的图片格式是4位16色的100*150的BMP
                prow:=tembmp.ScanLine[0];//这读取的是第一行还是最后一行?
                for i := 0 to tembmp.Width - 1 do
                begin
                  Memo1.Lines.Add(IntToHex(prow[i],2));//这里怎么把prow的内存16进制的数据显示出来呢?就像OD的那样:00 00 FF ……
                end;
              finally
                tembmp.Free;
              end;
        end;
    end;