home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / delphi / imagelib / ublob.pa_ / ublob.pa
Text File  |  1995-10-01  |  23KB  |  707 lines

  1. {Part of Imagelib VCL/DLL Library.
  2. Written by Jan Dekkers and Kevin Adams (c) 1995. If you are a non
  3. registered client, you may use or alter this demo only for evaluation
  4. purposes.
  5.  
  6. Uses ImageLib 3.0
  7.  
  8. Bug fixes:
  9.  
  10. Changed callback in version 2.21 to a function with cdecl.
  11. using the C calling convention.
  12.  
  13. Version 2.2.2 Added property ImageLibPalette which if set to True will
  14. use the ImageLib Way to paint. If false it will paint the Delphi way.
  15. This is a fix of a Stretchdraw Delphi bug which doesn't paint correctly
  16. 256 color palettes on 256 color Video cards}
  17.  
  18. unit Ublob;
  19.  
  20. interface
  21.  
  22. uses
  23.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  24.   Forms, Dialogs, DB, DBTables, StdCtrls, ExtCtrls, DBCtrls, Gauges, Mask,
  25.   Buttons, Clipbrd, Spin, U_p_size, Printers, Ufullscr, UAbout, 
  26.   DLL30, TDMultiP;
  27.  
  28. type
  29.   TBlobForm1 = class(TForm)
  30.     Table1              : TTable;
  31.     DataSource1         : TDataSource;
  32.     DBNavigator1        : TDBNavigator;
  33.     Gauge1              : TGauge;
  34.     AutodisplayCheckBox : TCheckBox;
  35.     DBEdit1             : TDBEdit;
  36.     StretchCheckBox     : TCheckBox;
  37.     BitBtn1: TBitBtn;
  38.     OpenDialog1: TOpenDialog;
  39.     SaveDialog1: TSaveDialog;
  40.     BitBtn2: TBitBtn;
  41.     GroupBox1: TGroupBox;
  42.     RadioButton1: TRadioButton;
  43.     RadioButton2: TRadioButton;
  44.     RadioButton3: TRadioButton;
  45.     CenterCheckBox: TCheckBox;
  46.     BitBtn4: TBitBtn;
  47.     BitBtn5: TBitBtn;
  48.     Timer1: TTimer;
  49.     BitBtn6: TBitBtn;
  50.     Edit1: TEdit;
  51.     BitBtn3: TBitBtn;
  52.     OpenDialog2: TOpenDialog;
  53.     Edit2: TEdit;
  54.     Edit3: TEdit;
  55.     Edit4: TEdit;
  56.     Edit5: TEdit;
  57.     Edit6: TEdit;
  58.     Label1: TLabel;
  59.     Label2: TLabel;
  60.     Label3: TLabel;
  61.     Label4: TLabel;
  62.     Label5: TLabel;
  63.     Label6: TLabel;
  64.     Edit7: TEdit;
  65.     Label7: TLabel;
  66.     Edit8: TEdit;
  67.     GroupBox2: TGroupBox;
  68.     RadioButton4: TRadioButton;
  69.     RadioButton5: TRadioButton;
  70.     BitBtn7: TBitBtn;
  71.     BitBtn8: TBitBtn;
  72.     SaveDialog2: TSaveDialog;
  73.     GroupBox3: TGroupBox;
  74.     SpinEdit1: TSpinEdit;
  75.     SpinEdit2: TSpinEdit;
  76.     Label8: TLabel;
  77.     Label9: TLabel;
  78.     BitBtn9: TBitBtn;
  79.     PrintDialog1: TPrintDialog;
  80.     BitBtn11: TBitBtn;
  81.     BitBtn12: TBitBtn;
  82.     BitBtn13: TBitBtn;
  83.     DBMultiImage1: TPDBMultiImage;
  84.     RadioButton6: TRadioButton;
  85.     RadioButton7: TRadioButton;
  86.     RadioButton9: TRadioButton;
  87.     BitBtn14: TBitBtn;
  88.     BitBtn15: TBitBtn;
  89.     BitBtn16: TBitBtn;
  90.     BitBtn10: TBitBtn;
  91.     procedure FormCreate(Sender: TObject);
  92.     procedure AutodisplayCheckBoxClick(Sender: TObject);
  93.     procedure StretchCheckBoxClick(Sender: TObject);
  94.     procedure DataSource1DataChange(Sender: TObject; Field: TField);
  95.     procedure BitBtn1Click(Sender: TObject);
  96.     procedure BitBtn2Click(Sender: TObject);
  97.     procedure ResolutionClick(Sender: TObject);
  98.     procedure CenterCheckBoxClick(Sender: TObject);
  99.     procedure BitBtn4Click(Sender: TObject);
  100.     procedure BitBtn5Click(Sender: TObject);
  101.     procedure Timer1Timer(Sender: TObject);
  102.     procedure BitBtn6Click(Sender: TObject);
  103.     procedure BitBtn3Click(Sender: TObject);
  104.     procedure RadioButton4Click(Sender: TObject);
  105.     procedure BitBtn7Click(Sender: TObject);
  106.     procedure BitBtn8Click(Sender: TObject);
  107.     procedure SpinEdit2Change(Sender: TObject);
  108.     procedure SpinEdit1Change(Sender: TObject);
  109.     procedure BitBtn9Click(Sender: TObject);
  110.     procedure BitBtn11Click(Sender: TObject);
  111.     procedure BitBtn12Click(Sender: TObject);
  112.     procedure BitBtn13Click(Sender: TObject);
  113.     procedure RadioButton5Click(Sender: TObject);
  114.     procedure RadioButton6Click(Sender: TObject);
  115.     procedure RadioButton7Click(Sender: TObject);
  116.     procedure RadioButton9Click(Sender: TObject);
  117.     procedure BitBtn14Click(Sender: TObject);
  118.     procedure BitBtn15Click(Sender: TObject);
  119.     procedure BitBtn16Click(Sender: TObject);
  120.     procedure BitBtn10Click(Sender: TObject);
  121.     procedure FormDestroy(Sender: TObject);
  122.   private
  123.     { Private declarations }
  124.     Procedure Trigger(Sender : TObject; Var Done : Boolean);
  125.   public
  126.     { Public declarations }
  127.   end;
  128.  
  129. var
  130.   BlobForm1: TBlobForm1;
  131.  
  132. implementation
  133.  
  134. {IMPORTANT}
  135. {Changed in version 2.21 from a procedure to a function with cdecl.
  136.  To cancel return a 0 else return a 1}
  137.  
  138. Function CallMe(i : integer) : integer; cdecl; export;
  139. {Callback function from the dll, CDECL and EXPORT ARE REQUIRED}
  140.  
  141. begin
  142.  if Application.Terminated then begin
  143.    {User wants to terminate the program. Pass a 0 to the dll}
  144.    Result:=0;
  145.   end else begin
  146.   {Be nice to others <g>}
  147.    Application.ProcessMessages;
  148.    {process a Gauge}
  149.    if BlobForm1 <> nil then
  150.     BlobForm1.Gauge1.Progress:=i;
  151.    {tell the dll that everything is OK}
  152.    Result:=1;
  153.    end;
  154. end;
  155. {---------------------------------------------------------------------}
  156.  
  157.  
  158. function JustPathname(PathName : string) : string;
  159.     {-Return just the drive:directory portion of a pathname}
  160.   var
  161.     I : Word;
  162.   const
  163.      DosDelimSet : set of Char = ['\', ':', #0];
  164.   begin
  165.     I := Succ(Word(Length(PathName)));
  166.     repeat
  167.       Dec(I);
  168.     until (PathName[I] in DosDelimSet) or (I = 0);
  169.  
  170.     if I = 0 then
  171.       {Had no drive or directory name}
  172.       JustPathname[0] := #0
  173.     else if I = 1 then
  174.       {Either the root directory of default drive or invalid pathname}
  175.       JustPathname := PathName[1]
  176.     else if (PathName[I] = '\') then begin
  177.       if PathName[Pred(I)] = ':' then
  178.         {Root directory of a drive, leave trailing backslash}
  179.         JustPathname := Copy(PathName, 1, I)
  180.       else
  181.         {Subdirectory, remove the trailing backslash}
  182.         JustPathname := Copy(PathName, 1, Pred(I));
  183.     end else
  184.       {Either the default directory of a drive or invalid pathname}
  185.       JustPathname := Copy(PathName, 1, I);
  186.   end;
  187. {---------------------------------------------------------------------}
  188.  
  189. {$R *.DFM}
  190. procedure TBlobForm1.FormCreate(Sender: TObject);
  191. begin
  192.  {Assign a callback function to the VCL/DLL}
  193.  TPDBMultiImageCallBack:=CallMe;
  194.  {Is Autodisplay Initial on or off}
  195.  DBMultiImage1.AutoDisPlay:=AutodisplayCheckBox.Checked;
  196.  {If the image data is changed save the blob to a jpeg or Bmp blob}
  197.  DBMultiImage1.UpdateAsJpg:=RadioButton4.Checked;
  198.  
  199.  {set the values of teh spin edit controls to the values of the vcl}
  200.  SpinEdit2.Value:=DBMultiImage1.JPegSaveSmooth;
  201.  SpinEdit1.Value:=DBMultiImage1.JPegSaveQuality;
  202.  
  203.  If FileExists(ExtractFilePath(Application.ExeName)+'JPSTAMP.DBF') then begin
  204.    {if the table exists open it on creation}
  205.    Table1.DataBaseName:=JustPathName(Application.ExeName);
  206.    Table1.TableName:='JPSTAMP.DBF';
  207.    Table1.Active:=True;
  208.    {Table1.Last;}
  209.  end;
  210.  
  211.  
  212.  {IMPORTANT
  213.  This is the moving engine for all the messages. Since an applcation
  214.  can have only one OnIdle Trigger, this trigger needs to be subdivided
  215.    by all your moving and animated objects. In this particular case the
  216.  function is called TRIGGER but you can name it as you want as long
  217.  you have a procedure named the same.}
  218.  
  219.   Application.OnIdle:=Trigger;
  220. end;
  221. {---------------------------------------------------------------------}
  222.  
  223. Procedure TBlobForm1.Trigger(Sender : TObject; Var Done : Boolean);
  224. begin
  225.  {IMPORTANT}
  226.  {This function is called when your app is idle. Subdivide the
  227.   trigger event to your TDBMultiImage objects who may need one.
  228.   If no Message is active it will not take up significant time}
  229.  
  230.   DBMultiImage1.Trigger;
  231. end;
  232. {---------------------------------------------------------------------}
  233.  
  234. procedure TBlobForm1.AutodisplayCheckBoxClick(Sender: TObject);
  235. begin
  236.   {Toggle Autodisplay}
  237.   DBMultiImage1.AutoDisPlay:=AutodisplayCheckBox.Checked;
  238.  
  239.   {Let users know to double click when autodisplay is off}
  240.   DBMultiImage1.ShowHint:= not AutodisplayCheckBox.Checked;
  241.  
  242.   {reset the gauge to 0}
  243.   Gauge1.Progress:=0;
  244. end;
  245. {---------------------------------------------------------------------}
  246.  
  247. procedure TBlobForm1.StretchCheckBoxClick(Sender: TObject);
  248. begin
  249.  {Stretch DBImage}
  250.  DBMultiImage1.Stretch:=StretchCheckBox.Checked;
  251.  
  252.  {reset the gauge to 0}
  253.   Gauge1.Progress:=0;
  254. end;
  255. {---------------------------------------------------------------------}
  256.  
  257. procedure TBlobForm1.CenterCheckBoxClick(Sender: TObject);
  258. begin
  259.  {Center DBImage}
  260.  DBMultiImage1.Center:=CenterCheckBox.Checked;
  261.  
  262.  {reset the gauge to 0}
  263.  Gauge1.Progress:=0;
  264. end;
  265. {---------------------------------------------------------------------}
  266.  
  267. procedure TBlobForm1.DataSource1DataChange(Sender: TObject; Field: TField);
  268. begin
  269.  {Reset the Gauge}
  270.   Gauge1.Progress:=0;
  271.  
  272.  {If DBMultiImage1.autodisplay = false then get the blob info
  273.   manually else the vcl will do it automatically}
  274.   If not DBMultiImage1.autodisplay then DBMultiImage1.GetInfoAndType;
  275.  
  276.  {Show the user the blob info}
  277.   Edit1.text:='This blob image is a '+DBMultiImage1.BFiletype;
  278.   Edit2.text:=IntToStr(DBMultiImage1.Bwidth);
  279.   Edit3.text:=IntToStr(DBMultiImage1.BHeight);
  280.   Edit4.text:=IntToStr(DBMultiImage1.Bbitspixel);
  281.   Edit5.text:=IntToStr(DBMultiImage1.Bplanes);
  282.   Edit6.text:=IntToStr(DBMultiImage1.Bnumcolors);
  283.   Edit7.text:=DBMultiImage1.Bcompression;
  284.   Edit8.text:=IntToStr(DBMultiImage1.BSize)+ ' bytes';
  285. end;
  286. {---------------------------------------------------------------------}
  287.  
  288. procedure TBlobForm1.BitBtn1Click(Sender: TObject);
  289. begin
  290.  {load a image file in the current blob}
  291.  
  292.  If OpenDialog1.Execute Then begin
  293.    {Place table in edit mode}
  294.    Table1.Edit;
  295.    {Load the image from file into the blob}
  296.    DBMultiImage1.LoadFromFile(OpenDialog1.FileName);
  297.    {Post the blob}
  298.    Table1.Post;
  299.    {reset the gauge to 0}
  300.    Gauge1.Progress:=0;
  301.  end;
  302. end;
  303. {---------------------------------------------------------------------}
  304.  
  305. procedure TBlobForm1.BitBtn2Click(Sender: TObject);
  306. var temp : string;
  307. begin
  308.  {Save the current blob to a jpeg, pcx, gif or Bmp  file.  The SaveToFile
  309.  will save it as stored in the blob. (no conversion is done here)
  310.  Use SaveToFileAsBMP or SaveToFileAsJpeg to Convert to one another}
  311.  
  312.  {get the extension (filetype) of the stored blob}
  313.  {GetInfoAndType returns the extension of the blob stored}
  314.  if not table1.active then exit;
  315.  temp:=DBMultiImage1.GetInfoAndType;
  316.  
  317.  if temp = 'GIF' then begin
  318.  {set SaveDialog filter to display gif's only}
  319.   SaveDialog1.filter:='GIF files|*.GIF';
  320.  
  321.   {set SaveDialog Default extension}
  322.   SaveDialog1.DefaultExt:='GIF';
  323.  end else
  324.  
  325.  if temp = 'PCX' then begin
  326.  {set SaveDialog filter to display pcx's only}
  327.   SaveDialog1.filter:='PCX files|*.PCX';
  328.  
  329.   {set SaveDialog Default extension}
  330.   SaveDialog1.DefaultExt:='PCX';
  331.  end else
  332.  
  333.  if temp = 'JPG' then begin
  334.  {set SaveDialog filter to display jpeg's only}
  335.   SaveDialog1.filter:='Jpeg files|*.JPG';
  336.  
  337.   {set SaveDialog Default extension}
  338.   SaveDialog1.DefaultExt:='JPG';
  339.  end else
  340.  
  341.  if temp = 'BMP' then begin
  342.  {set SaveDialog filter to display bmp's only}
  343.   SaveDialog1.filter:='BMP files|*.BMP';
  344.   {set SaveDialog Default extension}
  345.   SaveDialog1.DefaultExt:='BMP';
  346.  end;
  347.  
  348.  {save it to file as stored in blob}
  349.  If SaveDialog1.Execute Then
  350.    DBMultiImage1.SaveToFile(SaveDialog1.FileName);
  351.  {reset the gauge to 0}
  352.  Gauge1.Progress:=0;
  353. end;
  354. {---------------------------------------------------------------------}
  355.  
  356.  
  357. procedure TBlobForm1.ResolutionClick(Sender: TObject);
  358. begin
  359.  
  360.  {Set resolution and dither the image}
  361.  
  362.  if RadioButton1.Checked then begin
  363.  {Set resolution to 16 colors}
  364.   DBMultiImage1.ImageReadRes:=Color16;
  365.  {Set dither }
  366.   DBMultiImage1.ImageDither:=True;
  367.  end else
  368.  
  369.  if RadioButton2.Checked then begin
  370.  {Set resolution to 256 colors}
  371.   DBMultiImage1.ImageReadRes:=Color256;
  372.  {Set dither }
  373.   DBMultiImage1.ImageDither:=True;
  374.  end else
  375.  
  376.  if RadioButton3.Checked then begin
  377.   {Set resolution to true color}
  378.   DBMultiImage1.ImageReadRes:=ColorTrue;
  379.  {Set dither }
  380.   DBMultiImage1.ImageDither:=True;
  381.  end;
  382.  
  383.  {Reload the image }
  384.  Table1.Refresh;
  385.  
  386.  {reset the gauge to 0}
  387.  Gauge1.Progress:=0;
  388. end;
  389. {---------------------------------------------------------------------}
  390.  
  391.  
  392. procedure TBlobForm1.BitBtn4Click(Sender: TObject);
  393. begin
  394.   {Check to see if image is there}
  395.   if DBMultiImage1.Picture.Bitmap <> nil then
  396.    {Copy the image to the clipboard}
  397.     DBMultiImage1.CopyToClipboard;
  398.    {reset the gauge to 0}
  399.    Gauge1.Progress:=0;
  400. end;
  401. {---------------------------------------------------------------------}
  402.  
  403. procedure TBlobForm1.BitBtn5Click(Sender: TObject);
  404. {Paste image from clipboard}
  405. begin
  406.    {does the clipboard has the right format?}
  407.    if Clipboard.HasFormat(CF_PICTURE) then
  408.    {Yep it does. Paste image from clipboard}
  409.    DBMultiImage1.PastefromClipboard;
  410.  
  411.    {reset the gauge to 0}
  412.    Gauge1.Progress:=0;
  413. end;
  414. {---------------------------------------------------------------------}
  415.  
  416. procedure TBlobForm1.Timer1Timer(Sender: TObject);
  417. begin
  418.   {En/Disable Paste Button if clipboard has format}
  419.   BitBtn5.Enabled:=Clipboard.HasFormat(CF_PICTURE);
  420.   {Enable/disable certain buttons}
  421.   {Button is only then enabled if table is active}
  422.   BitBtn1.Enabled:=Table1.Active;
  423.   {Button is only then enabled if table is active}
  424.   BitBtn2.Enabled:=Table1.Active;
  425.   {Button is only then enabled if table is active}
  426.   BitBtn4.Enabled:=Table1.Active;
  427.   {Button is only then enabled if table is active}
  428.   BitBtn6.Enabled:=Table1.Active;
  429.   {Button is only then enabled if table is active}
  430.   BitBtn7.Enabled:=Table1.Active;
  431.   {Button is only then enabled if table is active}
  432.   BitBtn8.Enabled:=Table1.Active;
  433.   {Button is only then enabled if table is active}
  434.   BitBtn9.Enabled:=Table1.Active;
  435.   {Button is only then enabled if table is active}
  436.   BitBtn11.Enabled:=Table1.Active;
  437.   {Button is only then enabled if table is active}
  438.   BitBtn13.Enabled:=Table1.Active;
  439.   {Box is only then visible if table is active and field is in edit state}
  440.   GroupBox2.Visible:=Table1.Active and (DataSource1.State in [dsEdit, dsInsert]);
  441.   {Box is only then visible if table is active and field is in edit state and update is in jpeg mode}
  442.   GroupBox3.Visible:=Table1.Active and RadioButton4.Checked and (DataSource1.State in [dsEdit, dsInsert]);
  443. end;
  444. {---------------------------------------------------------------------}
  445.  
  446. procedure TBlobForm1.BitBtn6Click(Sender: TObject);
  447. begin
  448.  {Append a record and store an image file into the blob}
  449.  If OpenDialog1.Execute Then begin
  450.    {Place table in edit mode}
  451.    Table1.Append;
  452.    {Load the image from file into the blob}
  453.    DBMultiImage1.LoadFromFile(OpenDialog1.FileName);
  454.    {Post the blob}
  455.    Table1.Post;
  456.    {reset the gauge to 0}
  457.    Gauge1.Progress:=0;
  458.  end;
  459. end;
  460. {---------------------------------------------------------------------}
  461.  
  462. procedure TBlobForm1.BitBtn3Click(Sender: TObject);
  463. begin
  464. {open the table}
  465.       If OpenDialog2.execute then begin
  466.         Table1.Active:=False;
  467.         Table1.DataBaseName:=JustPathname(OpenDialog2.FileName);
  468.         Table1.TableName:=OpenDialog2.FileName;
  469.         Table1.Active:=True;
  470.       end;
  471. end;
  472. {---------------------------------------------------------------------}
  473.  
  474. procedure TBlobForm1.RadioButton4Click(Sender: TObject);
  475. begin
  476.  {If the image data is changed save the blob to a jpeg blob}
  477.  DBMultiImage1.UpdateASJpg:=RadioButton4.Checked;
  478.  
  479.  {Hide or show the jpeg update/save options}
  480.  GroupBox3.Visible:=RadioButton4.Checked;
  481. end;
  482. {---------------------------------------------------------------------}
  483.  
  484. procedure TBlobForm1.BitBtn7Click(Sender: TObject);
  485.  {save or convert the blob to a BMP file}
  486.  {make sure that the blob is displayed before saving to file}
  487. begin
  488.   {set SaveDialog filter to display bmp's only}
  489.   SaveDialog2.filter:='BMP files|*.BMP';
  490.  
  491.   {set SaveDialog Default extension}
  492.   SaveDialog2.DefaultExt:='BMP';
  493.  
  494.   if SaveDialog2.Execute then
  495.   {Save it}
  496.   DBMultiImage1.SaveToFileAsBMP(SaveDialog2.Filename);
  497.  
  498.   {reset the gauge to 0}
  499.   Gauge1.Progress:=0;
  500. end;
  501. {---------------------------------------------------------------------}
  502.  
  503. procedure TBlobForm1.BitBtn8Click(Sender: TObject);
  504.  {save or convert the blob to a Jpeg file}
  505.  {make sure that the blob is displayed before saving to file}
  506. begin
  507.   {set SaveDialog filter to display jpeg's only}
  508.   SaveDialog2.filter:='Jpeg files|*.JPG';
  509.  
  510.   {set SaveDialog Default extension}
  511.   SaveDialog2.DefaultExt:='JPG';
  512.  
  513.   if SaveDialog2.Execute then
  514.   {Save it}
  515.   DBMultiImage1.SaveToFileAsJpg(SaveDialog2.Filename);
  516.  
  517.   {reset the gauge to 0}
  518.   Gauge1.Progress:=0;
  519. end;
  520. {---------------------------------------------------------------------}
  521.  
  522. procedure TBlobForm1.SpinEdit2Change(Sender: TObject);
  523. begin
  524.   {Set the smooth of the jpeg to save or upate a blob}
  525.   DBMultiImage1.JPegSaveSmooth:=SpinEdit2.Value;
  526. end;
  527. {---------------------------------------------------------------------}
  528.  
  529. procedure TBlobForm1.SpinEdit1Change(Sender: TObject);
  530. begin
  531.   {Set the quality of the jpeg to save or upate a blob}
  532.   DBMultiImage1.JPegSaveQuality:=SpinEdit1.Value;
  533. end;
  534. {---------------------------------------------------------------------}
  535.  
  536. procedure TBlobForm1.BitBtn9Click(Sender: TObject);
  537. begin
  538.   if PrintDialog1.execute then begin
  539.   {Initialize the height spinedit of the printsize dialog box}
  540.    Printersize.HeigthSpinEdit.Value:=DBMultiImage1.Picture.Height;
  541.    {Initialize the width spinedit of the printsize dialog box}
  542.    Printersize.WidthSpinEdit.Value:=DBMultiImage1.Picture.Width;
  543.    {Show it}
  544.    Printersize.ShowModal;
  545.    if Printersize.Modalresult = mrok then
  546.  
  547.     {print TMultiImage}
  548.      DBMultiImage1.PrintMultiImage(0,0,Printersize.WidthSpinEdit.Value,Printersize.HeigthSpinEdit.Value);
  549.  
  550.    {Hide it if done}
  551.    Printersize.hide;
  552.   end;
  553. end;
  554. {---------------------------------------------------------------------}
  555.  
  556. procedure TBlobForm1.BitBtn11Click(Sender: TObject);
  557. begin
  558.   {copy DB Blob image to fullscreen image}
  559.   FullSlide.MultiImage1.Picture.Graphic:=DBMultiImage1.Picture.Graphic;
  560.   {show the image fulscreen}
  561.   FullSlide.showmodal;
  562. end;
  563. {---------------------------------------------------------------------}
  564.  
  565. procedure TBlobForm1.BitBtn12Click(Sender: TObject);
  566. {about box}
  567. begin
  568. {Copy the image to the image of he about box}
  569.  AboutBox.Image1.Picture.Graphic:=DBMultiImage1.Picture.Graphic;
  570. {show the about box}
  571.  AboutBox.showmodal;
  572. end;
  573. {---------------------------------------------------------------------}
  574.  
  575. procedure TBlobForm1.BitBtn13Click(Sender: TObject);
  576. begin
  577.     {Place the Database in append mode}
  578.     Table1.Append;
  579.     {Create a New Message}
  580.     If DBMultiImage1.CreateMessage then
  581.     {Post or cancel that thing}
  582.       Table1.Post
  583.     else
  584.       Table1.Cancel;
  585. end;
  586. {---------------------------------------------------------------------}
  587.  
  588. procedure TBlobForm1.RadioButton5Click(Sender: TObject);
  589. begin
  590.  {If the image data is changed save the blob to Bmp blob}
  591.  DBMultiImage1.UpdateASBMP:=RadioButton5.Checked;
  592.  
  593.  {Hide or show the update/save options}
  594.  GroupBox3.Visible:=RadioButton4.Checked;
  595. end;
  596. {---------------------------------------------------------------------}
  597.  
  598. procedure TBlobForm1.RadioButton6Click(Sender: TObject);
  599. begin
  600.  {If the image data is changed save the blob to a GIF blob}
  601.  DBMultiImage1.UpdateASGif:=RadioButton4.Checked;
  602.  
  603.  {Hide or show the jpeg update/save options}
  604.  GroupBox3.Visible:=RadioButton4.Checked;
  605. end;
  606. {---------------------------------------------------------------------}
  607.  
  608. procedure TBlobForm1.RadioButton7Click(Sender: TObject);
  609. begin
  610.  {If the image data is changed save the blob to a PCX blob}
  611.  DBMultiImage1.UpdateASPcx:=RadioButton4.Checked;
  612.  
  613.  {Hide or show the jpeg update/save options}
  614.  GroupBox3.Visible:=RadioButton4.Checked;
  615. end;
  616. {---------------------------------------------------------------------}
  617.  
  618. procedure TBlobForm1.RadioButton9Click(Sender: TObject);
  619. begin
  620.  {If the image data is changed save the blob to a PNG blob}
  621.  DBMultiImage1.UpdateASPng:=RadioButton4.Checked;
  622.  
  623.  {Hide or show the jpeg update/save options}
  624.  GroupBox3.Visible:=RadioButton4.Checked;
  625. end;
  626. {---------------------------------------------------------------------}
  627.  
  628. procedure TBlobForm1.BitBtn14Click(Sender: TObject);
  629.  {save or convert the blob to a GIF file}
  630.  {make sure that the blob is displayed before saving to file}
  631. begin
  632.   {set SaveDialog filter to display bmp's only}
  633.   SaveDialog2.filter:='GIF files|*.GIF';
  634.  
  635.   {set SaveDialog Default extension}
  636.   SaveDialog2.DefaultExt:='GIF';
  637.  
  638.   if SaveDialog2.Execute then
  639.   {Save it}
  640.   DBMultiImage1.SaveToFileAsGIF(SaveDialog2.Filename);
  641.  
  642.   {reset the gauge to 0}
  643.   Gauge1.Progress:=0;
  644. end;
  645. {---------------------------------------------------------------------}
  646.  
  647. procedure TBlobForm1.BitBtn15Click(Sender: TObject);
  648.  {save or convert the blob to a PCX file}
  649.  {make sure that the blob is displayed before saving to file}
  650. begin
  651.   {set SaveDialog filter to display bmp's only}
  652.   SaveDialog2.filter:='PCX files|*.PCX';
  653.  
  654.   {set SaveDialog Default extension}
  655.   SaveDialog2.DefaultExt:='PCX';
  656.  
  657.   if SaveDialog2.Execute then
  658.   {Save it}
  659.   DBMultiImage1.SaveToFileAsBMP(SaveDialog2.Filename);
  660.  
  661.   {reset the gauge to 0}
  662.   Gauge1.Progress:=0;
  663. end;
  664. {---------------------------------------------------------------------}
  665.  
  666. procedure TBlobForm1.BitBtn16Click(Sender: TObject);
  667.  {save or convert the blob to a PNG file}
  668.  {make sure that the blob is displayed before saving to file}
  669. begin
  670.   {set SaveDialog filter to display bmp's only}
  671.   SaveDialog2.filter:='PNG files|*.PNG';
  672.  
  673.   {set SaveDialog Default extension}
  674.   SaveDialog2.DefaultExt:='PNG';
  675.  
  676.   if SaveDialog2.Execute then
  677.   {Save it}
  678.   DBMultiImage1.SaveToFileAsBMP(SaveDialog2.Filename);
  679.  
  680.   {reset the gauge to 0}
  681.   Gauge1.Progress:=0;
  682. end;
  683. {---------------------------------------------------------------------}
  684. {---------------------------------------------------------------------}
  685.  
  686. procedure TBlobForm1.BitBtn10Click(Sender: TObject);
  687. begin
  688.     {Place the Database in append mode}
  689.     Table1.Append;
  690.     {Create a New Credit Message}
  691.     If DBMultiImage1.CreateCreditMessage then
  692.     {Post or cancel that thing}
  693.       Table1.Post
  694.     else
  695.       Table1.Cancel;
  696. end;
  697.  
  698. procedure TBlobForm1.FormDestroy(Sender: TObject);
  699. begin
  700.  {Unregister the callback function to the VCL/DLL}
  701.  TPDBMultiImageCallBack:=Nil;
  702.  Application.OnIdle:=Nil;
  703.  BlobForm1 := Nil;
  704. end;
  705.  
  706. end.
  707.