Skip to content

Instantly share code, notes, and snippets.

@MySohoWiki
Created October 26, 2022 05:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save MySohoWiki/c944cb479365625e8e73e70fd012f70e to your computer and use it in GitHub Desktop.
Form with image
//Συναλλαγές, εργασία: "show φορμα" , στη φόρμα πατώντας κλικ εμφανίζει την εικόνα τους είδους (αν έχει)
var
f: Tform;
cImage: TImage;
procedure DoClick2;
begin
f.visible:= true;
end;
procedure cImage_OnClick;
var
ds: TclientDataSet;
begin
if itemtrnds['iteDescr'].isnull then
exit;
ds:= prg.QueryDataSet(nil, 'exec usp_SelectImage :1', itemtrnds['itemID'].value);
try
TBlobField(ds.fields[1]).SaveToFile('d:\test1.png');
cImage.Picture.loadfromfile('d:\test1.png');
finally
ds.free;
end;
f.caption:= itemtrnds['iteDescr'].asstring;
end;
procedure BeforeLoad;
begin
showmessage('Hi');
end;
procedure init;
begin
frm.addinditask('show φορμα', @DoClick2, nil, true);
end;
Begin
bol.oninitialize:= @init;
f:= Tform.create(frm);
f.FormStyle:= fsStayOnTop;
f.SetBounds(800,200,200,200);
f.borderStyle:= bsSizeToolWin;
f.caption:= 'photo';
cImage:= TImage.create(f);
cImage.align:= alclient;
cImage.parent:= f;
cImage.OnClick:= @cImage_OnClick;
End.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment