var
a:ansistring;
f:ansistring;
bitfile:tbitmap;
jpgfile:tjpegimage;
begin
if xs_state='1' then
exit;
openpicturedialog1.Execute;
a:=openpicturedialog1.FileName;
if a <>'' then
try
image1.Picture.LoadFromFile(a);
if (image1.Picture.Graphic.Height>340) or (image1.Picture.Graphic.Width>240) then
begin
showmessage('图片尺寸太大,请调整到340×240');
image1.Picture.Graphic:=nil;
exit;
end;
begin
image1.Picture.Graphic:=nil;
GroupBox3.Caption:='正在进行JPG到BMP格式转化';
bitfile:=tbitmap.Create();
jpgfile:=tjpegimage.create();
try
jpgfile.LoadFromFile(a);
bitfile.Width:= jpgfile.Width;
bitfile.Height:=jpgfile.Height;
bitfile.Assign(jpgfile);
bitfile.SaveToFile(f);
finally
bitfile.Free;
jpgfile.Free;
end;
GroupBox3.Caption:=' 转化成功';
image1.Picture.LoadFromFile(f);
end;
///
except
showmessage('装载图片出错!');
end;
end;
……..
if image1.Picture.Graphic=nil then
s:=s+')'
else
s:=s+',:b)' ;
with datamodule1.ADOQuery3 do
begin
close;
sql.Clear;
sql.Add(s);
if not (image1.Picture.Graphic=nil) then
Parameters.ParamByName('b').Assign(image1.Picture.Graphic);
try
execsql;
except
showmessage('添加信息失败,请再试试');
exit;
end;
end;
image1.Picture.Graphic:=nil;
f_main.ADOQuery4.Active :=false;
f_main.ADOQuery4.Active:=true;
showmessage('信息添加成功!');
。。。。。
s:=s+ 's_room='+''''+trim(edit12.Text)+''''+',';
s:=s+ 's_qq='+''''+trim(edit9.Text)+'''';
if not( image1.Picture.Graphic=nil) then
s:=s+ ',s_poto=:b';
s:=s+ ' where s_id='+''''+trim(xsid)+'''';
with DataModule1.ADOQuery1 do
begin
close;
sql.Clear;
SQL.add(s);
if not( image1.Picture.Graphic=nil) then
begin
Parameters.ParamByName('b').Assign(image1.Picture.Graphic);
//showmessage(sql.Text);
end;
execsql;
end;
f_main.ADOQuery4.Active :=false;
f_main.ADOQuery4.Active:=true;
showmessage('修改成功');
//修改××××××××××××××××××××××××××××、、//
end;
////////////////////////////////////////////////////////////
end;下载本文