?
Solved

i have problems with Timage

Posted on 1999-01-12
3
Medium Priority
?
174 Views
Last Modified: 2010-04-06
I use an Timage for capture an image of Clipboard (Ctrl+V), then when the user press the
button (save) my code is:

Procedure Tform1.Button1click(Sender:Tobject);
var
  st:Tfilestream;
begin
  if not table1.findkey([key.text]) then
  begin
    table1.appendrecord([key.text,name.text]);
    st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);
    image1.picture.graphic.savetostream(st);
    Table1.edit;
    Tblobfield(table1.fieldbyname('Photo')).loadfromstream(St);
    table1.post;
  end;
end;
     
and i have other Button

Tform1.Button2click(Sender:Tobject) ;
var
  st:Tfilestream;
begin
  if table1.findkey([key.text]) then
  begin
    name.text:=table1.fieldbyname('Name').asstring;
    st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);
    Tblobfield(Table1.fieldbyname('Photo')).savetostream(st);
    image1.picture.graphic.loadfromstream(st);
  end
  else
    caption:='Error';
end;

the 2 procedures not mark noting error, but when i press the Button2 only The Name.text
are filled but the Image1 noting

why

Thanks

i wait for not bother : )
0
Comment
Question by:jamiguel
  • 2
3 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356186
The LoadFromStream call does not recognise the file extension. You should set it to the approprite one (eg: .BMP for bitmap etc)

Cheers,

Raymond.
0
 

Author Comment

by:jamiguel
ID: 1356187
but the extension is that of less, since I have proven without extension, or I have to put you the extension .BMP, what is the way perfect, can you  illustrate me with any code the correct form?
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 0 total points
ID: 1356188
I think you should change this line

   st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);

to this

   st:=Tfilestream.create('c:\temp\temp.bmp',fmcreate);

I would also reset the stream position before reading in the image eg:

   st.position := 0;
   image1.picture.graphic.loadfromstream(st);


Raymond
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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 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