Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to assign a bitmap to the TDBImage?

Posted on 2002-03-19
7
Medium Priority
?
229 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 120 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

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!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

715 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