Solved

How to assign a bitmap to the TDBImage?

Posted on 2002-03-19
7
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Suggested Courses
Course of the Month5 days, 5 hours left to enroll

636 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