Solved

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

Posted on 2000-04-20
13
317 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
[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
  • 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
Technology Partners: 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 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

Technology Partners: 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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

756 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