Solved

i use the c++ bilder ,and i want to change the bitmap file to gif.

Posted on 2000-04-20
13
315 Views
Last Modified: 2011-10-03
i just want to change the bitmap file to gif file .how could i do?
my source code is:
 while(!Query1->Eof)
  {
      char szName[255];
      // get data from first table
      // and save data into csc
      String csc = Query1->FindField("STKCODE")->AsString;
      String mkt = Query1->FindField("MKT")->AsString;
      // into csc to second table and get data

      if(mkt == "TSE"){
      Query2->Close();

      Query2->SQL->Clear();
      Query2->SQL->Add("select scode,syear*100+smon,T3950,T3100");
      Query2->SQL->Add("from AP.ASEARN");
      Query2->SQL->Add("where SCODE =:sss");
      Query2->ParamByName("sss")->AsString= csc;
      Query2->Active=TRUE;


     // use the data of second table to draw the line chart


      Series1->DataSource=Query2;
      Series1->ParentChart=DBChart1;
      Series1->XLabelsSource="syear*100+smon";
      Series1->YValues->ValueSource= "T3950";
      Series2->DataSource=Query2;
      Series2->ParentChart=DBChart1;
      Series2->XLabelsSource="syear*100+smon";
      Series2->YValues->ValueSource= "T3100";
      wsprintf(szName,"e:\\gsearnsale\\gsearnsale%s.bmp",csc);
      DBChart1->SaveToBitmapFile(szName);
      Query1->Next();
      }

and i know maybe i should reload the saving bitmap file again!but i don't know what's kind of method i can use?
please help me .thanks.

                 
0
Comment
Question by:tewehuang
  • 7
  • 5
13 Comments
 
LVL 1

Expert Comment

by:jbodom
ID: 2736902
You could use a third party component to change from gif to bmp or vice-versa

http://www.melander.dk/delphi/gifimage/

0
 

Author Comment

by:tewehuang
ID: 2736979
Adjusted points from 100 to 120
0
 

Author Comment

by:tewehuang
ID: 2736980
i just reading the homepage.
but i can't understand how will i do.
because i don't know the delphi source
code.so would you mind write a sample to me.
thanks!
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 1

Expert Comment

by:jbodom
ID: 2737715
If you haven't done this already, to use the component, you must first download it from one of these sites:

http://www.melander.dk/cgi-bin/download/mirrors?package=tgifimage

Once you've downloaded it, follow these installation instructions for your version of C++ Builder:

http://www.melander.dk/delphi/gifimage/release_notes/install.html

Here's the code to convert from bmp to gif:

Graphics::TBitmap * bm = new Graphics::TBitmap();
TGIFImage *gf = new TGIFImage();
bm->LoadFromFile("test.bmp");
gf->Assign(bm);
gf->SaveToFile("test.gif");
delete bm;
delete gf;

If you need help to convert back the other way then let me know.  Make sure you include the appropriate headers.


0
 
LVL 1

Expert Comment

by:wolfpackinc
ID: 2741991
I would also find out first if you have gif support first, before you install TGifImage to avoid conflicts. As some package come with gif support. Like RX Library 2.60. To test if you have gif support slap a image component on a form
under the Picture property press Load and see if *.gif is included under the file types. You can disable the gif support in RX Library 2.60 and other packages if you want to use TGifImage Read ReadMe File.
0
 

Author Comment

by:tewehuang
ID: 2742782
dear jbodom:
     thanks for your help .but i can't
link the first web.could you mind show
me anthoer web address.thanks
                         tewehuang
0
 

Author Comment

by:tewehuang
ID: 2742800
dear jbodom:
     thanks for your help .but i can't
link the first web.could you mind show
me anthoer web address.thanks
                         tewehuang
0
 
LVL 1

Expert Comment

by:jbodom
ID: 2742861
Just go here and go to the download section.

http://www.melander.dk/delphi/gifimage/
0
 

Author Comment

by:tewehuang
ID: 2742916
i just use the method.
but how file i must include.
my means is like *.h.
my source code is :
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  char szName[255];
  char szName1[255];
   while(!Query1->Eof)
  {
    //get the ­ÓªÑ¸ê®Æªºstkcode

      String ind_stk = Query1->FindField("STKCODE")->AsString;
      String mkt = Query1->FindField("MKT")->AsString;


                    if (mkt == "TSE"){

                                             Query2->Close();
                                             Query2->SQL->Clear();
                                             Query2->SQL->Add("select sdate,cp");
                                             Query2->SQL->Add("from ap.aprcd_e");
                                             Query2->SQL->Add("where stkcode=:mem");
                                             Query2->ParamByName("mem")->AsString=ind_stk;
                                             Query2->Active = TRUE;
                                             //String stk_date = Query2->FindField("SYEAR*100+SMON")->AsString;
                                             /*Query3->Close();
                                             Query3->SQL->Clear();
                                             Query3->SQL->Add("select syear*100+smon,cp");
                                             Query3->SQL->Add("from ap.aisprcw");
                                             Query3->SQL->Add("where indid='Y9999'");
                                             Query3->SQL->Add("and (syear*100+smon) >=:date");
                                             Query3->ParamByName("date")->AsString=stk_date;
                                             Query3->Active = TRUE;
                                             */
                                             Series1->DataSource=Query2;
                                             Series1->ParentChart=DBChart1;
                                             Series1->XLabelsSource="sdate";
                                             Series1->YValues->ValueSource = "cp";
                                             /*Series2->DataSource=Query3;
                                             Series2->ParentChart=DBChart1;
                                             Series2->XLabelsSource="syear*100+smon";
                                             Series2->YValues->ValueSource = "cp";
                                             */
                                             wsprintf(szName,"e:\\gprcd\\gprcd%s.bmp",ind_stk);
                                             wsprintf(szName1,"e:\\gprcd\\gprcd%s.gif",ind_stk);
                                             DBChart1->SaveToBitmapFile(szName);
                                             Graphics::TBitmap * bm = new Graphics::TBitmap();
                                             TGIFImage *gf = new TGIFImage();
                                             bm->LoadFromFile("szName");
                                             gf->Assign(bm);
                                             gf->SaveToFile("szName1");
                                             delete bm;
                                             delete gf;

                                             Query1->Next();
                                }
the error meaaage is :
[C++ Error] Unit1.cpp(6): E2209 Unable to open include file 'gifimage.pas'.
[C++ Error] Unit1.cpp(62): E2451 Undefined symbol 'TGIFImage'.
thanks for your help!
0
 
LVL 1

Expert Comment

by:jbodom
ID: 2743711
You need to include

#include "gifimage.hpp"
0
 
LVL 1

Accepted Solution

by:
jbodom earned 120 total points
ID: 2743716
Of course, make sure you have the correct path in the above statement
0
 

Author Comment

by:tewehuang
ID: 2753810
i just include the headle file "gifimage.hpp".but the error message is
[C++ Error] gifimage.pas(1): E2141 Declaration syntax error.
and appear in the gifimage.h file.
how will i debug?
            thanks!
                      tewehuang
0
 

Author Comment

by:tewehuang
ID: 2754465
thanks my freiend:i already to find the
correct way to solve.
thanks a lots.
                eric
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

825 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