home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / full / delphi / DELPHI16 / TECHINFO / DELPHI / TIS / TI2810.FX < prev    next >
Encoding:
Text File  |  1995-08-24  |  2.6 KB  |  122 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Delphi                                 NUMBER  :  2810
  8.   VERSION  :  All
  9.        OS  :  Windows
  10.      DATE  :  July 14, 1995                            PAGE  :  1/2
  11.  
  12.     TITLE  :  Extracting A Bitmap From A BLOB Field
  13.  
  14.  
  15.  
  16.  
  17. Extracting a bitmap from a dBASE or Paradox blob field -- without first
  18. saving the bitmap out to a file -- is a simple process of using the Assign
  19. method to store the contents of the BLOB field to an object of type
  20. TBitmap. A stand-alone TBitmap object or the Bitmap property of the
  21. Picture object property of a TIMage component are examples of compatible
  22. destinations for this operation.
  23.  
  24. Here is an example demonstrating using the Assign method to copy a bitmap
  25. from a BLOB field into a TImage component.
  26.  
  27.   procedure TForm1.Button1Click(Sender: TObject);
  28.   begin
  29.     Image1.Picture.Bitmap.Assign(Table1Bitmap);
  30.   end;
  31.  
  32. In this example, the TBLOBField object Table1Bitmap is a BLOB field in a
  33. dBASE table. This TBLOBField object was created using the Fields Editor.
  34. If the Fields Editor is not used to create TFields for the fields in the
  35. table, the fields must be referenced using either the FieldByName method
  36. or the Fields property, both part of the TTable and TQuery components. In
  37. cases where one of those means is used to reference the BLOB field in a
  38. table, the field reference must be type-cast as a TBLOBField object prior
  39. to using the Assign method. For example:
  40.  
  41.   procedure TForm1.Button1Click(Sender: TObject);
  42.   begin
  43.     Image1.Picture.Bitmap.Assign(TBLOBField(Table1.Fields[1]));
  44.   end;
  45.  
  46. A bitmap stored in a BLOB field may also be copied directly to a stand-
  47. alone TBitmap object. Here is an example showing the creation of a
  48. TBitmap object and storing into it a bitmap from a BLOB field.
  49.  
  50.   procedure TForm1.Button2Click(Sender: TObject);
  51.   var
  52.     B: TBitmap;
  53.   begin
  54.     B := TBitmap.Create;
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.   PRODUCT  :  Delphi                                 NUMBER  :  2810
  69.   VERSION  :  All
  70.        OS  :  Windows
  71.      DATE  :  July 14, 1995                            PAGE  :  2/2
  72.  
  73.     TITLE  :  Extracting A Bitmap From A BLOB Field
  74.  
  75.  
  76.  
  77.  
  78.     try
  79.       B.Assign(Table1Bitmap);
  80.       Image1.Picture.Bitmap.Assign(B);
  81.     finally
  82.       B.Free;
  83.     end;
  84.   end;
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. DISCLAIMER: You have the right to use this technical information
  119. subject to the terms of the No-Nonsense License Statement that
  120. you received with the Borland product to which this information
  121. pertains.
  122.