Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

How to assign a bitmap to the TDBImage?

Hi all,
How to assign a bitmap to the TDBImage?
Now I use the following code, But I don't want to use the Clipboard, How to change it?

Thanks, Bin

--------------------->
  if OpenPictureDialog.Execute then
  begin
    with ImagePhoto do  //ImagePhoto is TDBImage
    begin
      Picture.LoadFromFile(OpenPictureDialog.FileName);
      CopyToClipboard;
      PasteFromClipboard;
    end;
  end;
---------------------<
0
xbbin
Asked:
xbbin
  • 4
  • 3
1 Solution
 
kretzschmarCommented:
if OpenPictureDialog.Execute then
begin
  TBlobField(Dataset.FieldByName('Photo')).LoadfromFile(OpenPictureDialog.filename);
end;

meikl ;-)

   
0
 
xbbinAuthor Commented:
Hi meikl,
Can you help me more? I will award you more points.

How to show the Image(TDBImage field) by some conditions?
Now I have to drop a TDBImage on the form, and drop a TImage on the TDBImage. The code as following, I don't like this way.

procedure DataSetAfterScroll(DataSet: TDataSet);
begin
  if DataSetEventMessage.AsString <> 'Normal' then
  begin
    EmpNoEdit.Text := '';
    EmpNameEdit.Text := '';
    Bitmap := TBitmap.Create;
    try
      with EmpPicture do  //EmpPicture  is TImage
      begin
        Bitmap.Width := Width;
        Bitmap.Height := Height;
        Picture.Bitmap := Bitmap;
      end;              //Clear the Image
    finally
      Bitmap.Free;
    end;
    end
    else
    begin
      EmpNoEdit.Text := DataSetEmpNo.AsString;
      EmpNameEdit.Text := DataSetEmpName.AsString;
      EmpPicture.Picture := DataSetEmpDBPhotoImage.Picture; //EmpPicture  is TImage
    end;
end;
0
 
xbbinAuthor Commented:
Hi meikl?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
kretzschmarCommented:
sorry, did not get any notification :-(
was just about reviewing my paq

can you explain a bit more, what you want to do?
which conditions?
0
 
kretzschmarCommented:
about the timage to clear

EmpPicture.Picture.Assign(Nil);
(thats just from head yet)

this should replace this code
----
try
     with EmpPicture do  //EmpPicture  is TImage
     begin
       Bitmap.Width := Width;
       Bitmap.Height := Height;
       Picture.Bitmap := Bitmap;
     end;              //Clear the Image
   finally
     Bitmap.Free;
   end;
----

meikl ;-)
0
 
xbbinAuthor Commented:
Hi meikl,
I had already sloved this, I used "DataSetEmpDBPhotoImage.Clear".    

Thanks, bin
0
 
kretzschmarCommented:
well
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now