unit frmObrazekKZ; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, ddPlugin_TLB; type TformObrazekKZ = class(TForm) Image1: TImage; btnKonec: TButton; Panel1: TPanel; procedure btnKonecClick(Sender: TObject); procedure FormShow(Sender: TObject); private procedure NactiObrazekZKmene; public Helios: IHelios; idKZ: integer; end; var formObrazekKZ: TformObrazekKZ; implementation uses datModul, helUtils; {$R *.dfm} function HexStringToMemoryStream (const HexStr: string): TMemoryStream; begin result:= TMemoryStream.Create; try result.Size:= Length(HexStr) div 2; if (result.Size>0) then HexToBin(PChar(HexStr), result.Memory, result.Size); except end; end; procedure TformObrazekKZ.FormShow(Sender: TObject); begin NactiObrazekZKmene; end; procedure TformObrazekKZ.NactiObrazekZKmene; var lSQL, data: string; Stream: TStream; begin if (idKZ>0) and (helUtils.sqlExistsTestGeneral(Helios, 'SELECT 1 FROM ' + tblKZ + ' WHERE Obrazek IS NOT NULL AND ID=' + idKZ.ToString)) then begin lSQL:= 'SELECT CONVERT(Varchar(max), Obrazek, 2) AS ObrazekData FROM ' + tblKZ + ' WHERE ID=' + idKZ.ToString; with Helios.OpenSQL(lSQL) do begin data:= FieldByNameValues('ObrazekData'); Image1.Picture.LoadFromStream(HexStringToMemoryStream(data)); self.Invalidate; end; end; end; procedure TformObrazekKZ.btnKonecClick(Sender: TObject); begin Close; end; end.