Solved

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

Posted on 2000-04-20
13
311 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

914 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now