标题:bcb新人 请教高手和前辈
只看楼主
csharp到bcb
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-8-25
 问题点数:0 回复次数:2 
bcb新人 请教高手和前辈
想用image2 显示 image1的略缩图,请各位高手和前辈 指点!感激不尽!
   void __fastcall TForm6::Button1Click(TObject *Sender)
{
      int srcWidth=this->Image1->Picture->Graphic->Width;
      int srcHeight=this->Image1->Picture->Graphic->Height;

      TMemoryStream * mStream=new TMemoryStream();
      this->Image1->Picture->Graphic->SaveToStream(mStream);
      mStream->Position=0;

      BITMAPINFO* bMAPINFO=new BITMAPINFO();
      bMAPINFO->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
      bMAPINFO->bmiHeader.biWidth=srcWidth;
      bMAPINFO->bmiHeader.biHeight=srcHeight;
      bMAPINFO->bmiHeader.biPlanes=1;
      bMAPINFO->bmiHeader.biBitCount=0;
      bMAPINFO->bmiHeader.biCompression=BI_JPEG;
      bMAPINFO->bmiHeader.biSizeImage=mStream->Size;

      char* buffer=new char[mStream->Size];
      mStream->ReadBuffer(buffer,mStream->Size) ;

      StretchDIBits(this->Image2->Canvas->Handle,
                    0,0,this->Image2->Width,this->Image2->Height,
                    0,0,srcWidth,srcHeight,
                    buffer,
                    bMAPINFO,
                    DIB_RGB_COLORS,
                    SRCCOPY);
      delete mStream;
      delete[] buffer;
}
搜索更多相关主题的帖子: bcb 前辈 新人 
2010-08-25 18:25
csharp到bcb
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-8-25
得分:0 
看看我问题在哪?
2010-08-25 18:28
jackVIII
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-11-14
得分:0 
有什么地方报错了吗
2010-11-16 19:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-316812-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.444164 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved