Solved

How to assign a bitmap to the TDBImage?

Posted on 2002-03-19
7
207 Views
Last Modified: 2010-04-05
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
Comment
Question by:xbbin
  • 4
  • 3
7 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 30 total points
ID: 6879507
if OpenPictureDialog.Execute then
begin
  TBlobField(Dataset.FieldByName('Photo')).LoadfromFile(OpenPictureDialog.filename);
end;

meikl ;-)

   
0
 

Author Comment

by:xbbin
ID: 6880016
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
 

Author Comment

by:xbbin
ID: 6881463
Hi meikl?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6888604
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6888623
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
 

Author Comment

by:xbbin
ID: 6888685
Hi meikl,
I had already sloved this, I used "DataSetEmpDBPhotoImage.Clear".    

Thanks, bin
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6889121
well
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now