1.我想将一个图片放大或缩小。例如:一张100*100的图片缩小成一张32*32的图片或放大成一张200*200的图片。
2.窗口上有一个加载图片按钮。我想让用户点击此按钮后出现的对话框中至出现各类图片文件(例如:BMP,JPG,GIF等等)
3.如何判断IMAGE控件中图片文件的类型

解决方案 »

  1.   

    选把Stretch:=True
    控制Image的Width和Height不就OK
      

  2.   

    给你一段代码,自己研究    ProgressBar1->Position=0;
        TRect   AAA,ARect ;
        Graphics::TBitmap *Bitmap;    DBImage1->CopyToClipboard();
        DBImage1->PasteFromClipboard();
        if (Clipboard()->HasFormat(CF_BITMAP))
        {
            Bitmap = new Graphics::TBitmap();
            try{
                Bitmap->Assign(Clipboard());
                float xw,xh;//,s_h,n_h,s_w,n_w;            int x_h=200;
                int x_w=x_h*((float)Bitmap->Width/(float)Bitmap->Height);
                delete_Image();
                TImage *Imagex=new TImage(image_proc);
                Imagex->Parent=ScrollBox1;
                Imagex->AutoSize=false;
                Imagex->Left=3;
                Imagex->Top=4;
                Imagex->Visible=true;
                Imagex->Width=x_w;
                Imagex->Height=x_h;
                Imagex->Name="Image2";            xh=(float)Bitmap->Height/(float)Imagex->Height;
                xw=(float)Bitmap->Width/(float)Imagex->Width;
                ProgressBar1->Max=Imagex->Height;
                for(int i=0;i<=Imagex->Height;i++)
                {
                    for(int j=0;j<=Imagex->Width;j++)
                    {
                    AAA = Rect(j,i,j+1,i+1);
                    ARect = Rect(xw*j,xh*i,xw*j+1,xh*i+1);
                    Imagex->Canvas->CopyRect(AAA, Bitmap->Canvas, ARect);
                    
                    }
                    ProgressBar1->Position=i;
                }
                //Imagex->AutoSize=true;
                delete Bitmap;
                }
                catch(...){
                delete Bitmap;
            }
        }
        ProgressBar1->Position=0;
        ok_pictrue=true;