Solved

i have problems with Timage

Posted on 1999-01-12
3
165 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
[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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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