请问如何把图片转换成字符串
解决方案 »
- 又一个SQL的简单问题,要分的进来啊
- 请问tform2.Create(nil)中的nil是什么意思啊?马上揭贴
- 主程序关闭的时候老是出错"abstract error"
- 新手向各位请教一个很初级问题,不要笑话,望指教
- Delphi 深入学习之路[讨论帖]
- 如何用修改注册表的方法修改系统的日期格式
- 如何将客户机和服务器的系统时间保持一致?
- 怎样用SQL将一个表的内容导入另一个表?
- 在form的.pas引用application.xxx没问题,但怎样在没有form的.pas中引用application?
- 快来拿!高分!插入数据出错,请赐教
- class TQRPrivew not found, 还有TAiHint和TQuickRep都 是什么控件
- 请问各位在侠,如何用ADO来连接本地的SQL数据库,如何连接网络上的?还有,如何在sql中创建数据库呀?我想转到SQL上,但是,我在XP下装了
按ctrl+c复制image组件
切换到代码窗口,ctrl+v
picture.date里的就是该图画的字符串,非常好用 :)
function b2c( b: Byte ):Char;
begin
case b of
0: result := '0';
1: result := '1';
2: result := '2';
3: result := '3';4: result := '4';5: result := '5';
6: result := '6';7: result := '7';8: result := '8';
9: result := '9';10: result := 'A';11: result := 'B';
12: result := 'C';13: result := 'D';14: result := 'E';
else result := 'F';
end;
end;
var
fm : TFileStream;
buf : PByte;
p : PByte;
s : string;
i, j, size : Integer; k:dword;
begin
if not OpenDlg1.Execute then
exit; fm := TFileStream.Create( OpenDlg1.FileName,fmOpenRead );
size := fm.Size;
buf := AllocMem( size );
fm.Read( buf^, size );
fm.Free;
k:= GetTickCount();
SetLength( s, size * 2 + (size div 16) * 2 );
i := 1;
j := 0;
p := buf;
repeat
s[i] := b2c( p^ shr 4 );
Inc( i );
s[i] := b2c( p^ and $0F );
Inc( i );
Inc( p );
Inc( j );
if j = 16 then
begin
j := 0;
s[i] := #13;
Inc( i );
s[i] := #10;
Inc( i );
end;
until i > Length(s); caption := IntToStr(GetTickCount()-k);
Memo1.Lines.Text := s;
end;
http://expert.csdn.net/Expert/topic/2809/2809573.xml?temp=.2032892