哎呀,写错了,应该gif图片,不是jpg图片

解决方案 »

  1.   

    第一个办法,用多个图片连续播放。当然,可心和同一个图片的多个复本,这主要是用TIMER做控制。
    第二个办法,写一个函数,用不同的位置显示同一由图片。
      

  2.   

    我不是想动画显示图片,而是在一个固定位置显示一张gif图片,而这张gif图片里的内容会动的,就像一些网站的广告一样。
      

  3.   

    看来大家是误解了我的意思,我是想在一个固定位置显示一张gif图片。举个例子,就好像本页左边一栏“图书信息”下面不是有一张gif图片吗?上面写着“广告业务联系”,其中“联系”两个字是一闪一闪的。我就是想用vc在程序中显示类似的gif图片,请教高手应该怎样做(本问题的标题写错了,应该是gif图片,而不是jpg图片)。
      

  4.   

    自己写的话,你必须熟悉GIF98格式的位图文件详细的细节才行了。
      

  5.   

    Victor Image Processing Library How-to Tips 
    Create an animated GIF
     
    Growing image created with Victor functions resizeex and savegifframe. The animation is contained in a series of frames in a single GIF file. For this example the original image is resized into each frame. The smallest size is placed in first and each successive frame receives a larger size. The savegifframe function appends each frame to the file. There are 10 resized image frames in the final GIF image file, growing.gif. Create a Growing Image Animation
    Requires Victor Image Processing Library v 5.3 or higher. // A helper function to find the white color in the palette.
    int findwhite(imgdes *srcimg)
    {
       int j;
       int r, g, b;
       int maxwhite = 0;
       int maxwhiteindex = -1;
     
       for(j = 0; j <= srcimg->colors; j++) {
          r = srcimg->palette[j].rgbRed;
          g = srcimg->palette[j].rgbGreen;
          b = srcimg->palette[j].rgbBlue;
          if(r == g && r == b)
             if (r > maxwhite) {
                maxwhiteindex = j;
                maxwhite = r;
                }
          }
     
       return maxwhiteindex;
    }
     
    // Make an animated gif of a growing image
    int makegrowingGIF(int frames, imgdes *srcimg)
    {
       int rcode = NO_ERROR;
       int cols, rows;
       int j;
       int wd, ht;
       imgdes desimg;
       int foundwhite;
       GifGlobalSaveData gdata;
       GifFrameSaveData fdata;
     
       if(srcimg->bmh->biBitCount != 8)
          return(BAD_BPP);
       
       cols = CALC_WIDTH(srcimg);
       rows = CALC_HEIGHT(srcimg);
       foundwhite = findwhite(srcimg);
       if(foundwhite < 0)          // Didn't find white 
          foundwhite = 0;          // Use color number zero as background 
     
       // GIF global data used by savegifframe(), etc.
       gdata.scrwidth = cols;
       gdata.scrlength = rows;
       gdata.hasColorMap = TRUE;   // Global color table is present!
       gdata.bckColor = foundwhite;// Color index of screen backgnd
       gdata.loop = 1000;          // Number of iterations
     
       // GIF frame data used by savegifframe(), etc.
       fdata.startx = 0;
       fdata.starty = 0;          // X,Y pixel position with respect to scrwidth, scrlength
       fdata.hasColorMap = FALSE;  // Local color table present?
       fdata.delay = 1;           // 100ths of a second to display frame
       fdata.transColor = -1;     // Transparent color index, -1 => none
       fdata.removeBy = 0;        // How graphic is to be treated after display
       fdata.waitForUserInput = FALSE; // If true, expect user input
     
       wd = cols/frames/2;
       ht = rows/frames/2;
       rcode = allocimage(&desimg, cols, rows, 8);
       copyimagepalette(srcimg, &desimg);
       zeroimage(foundwhite, &desimg);
     
       // First frame, plain white
       rcode = savegifframe("growing.gif", &desimg, &gdata, &fdata, GIFNOCOMP);
     
       for(j = frames-1; j >= 0; j--) {
          fdata.startx = wd*j;
          fdata.starty = ht*j;    // X,Y pixel position with respect to scrwidth, scrlength
          fdata.removeBy = 3;     // How graphic is to be treated after display
             //NOTHING    0 ?The image is left unremoved
             //ASIS       1 ?The image is left unremoved
             //PREVIOUS   2 ?The image is replaced by the previous image
             //BACKGROUND 3 ?The image is replaced by the background
     
          // Create a growing image 
          setimagearea(&desimg, fdata.startx, fdata.starty, cols-fdata.startx-1, rows-fdata.starty-1);
          resizeex(srcimg, &desimg, RESIZEFAST); /*1 = RESAMPLEBILINEAR*/
          rcode = savegifframe("growing.gif", &desimg, &gdata, &fdata, GIFNOCOMP);
          }
       freeimage(&desimg);
     
       return (rcode);
    }
    --------------------------------------------------------------------Copyright &copy; 2001 Catenary Systems Inc. All rights reserved. Victor Image Processing Library is a trade of Catenary Systems.不想要分,我不想用别人的东西赚分。:)
    只是帮忙而已,