C++Builder 截取图片

看网友们提问如何截取图片中的一部分,就查询帮助,写了一下:

void __fastcall TForm1::Button2Click(TObject *Sender) { int i_Width = 600 ; int i_Height = 600 ; Graphics::TBitmap *Bitmap = new Graphics::TBitmap; Graphics::TBitmap *Bit = new Graphics::TBitmap; TRect MyRect = Rect(0,0,i_Width,i_Height); TRect MyOther = Rect(0,0,i_Width,i_Height); Bit->Width = i_Width ; Bit->Height = i_Height ; Bitmap->Width = Image1->Width; Bitmap->Height = Image1->Height; Bitmap->Assign(Image1->Picture->Graphic); Bit->Canvas->CopyRect(MyOther,Bitmap->Canvas,MyRect); Bit->SaveToFile("D://3860.bmp") ; delete Bitmap ; delete Bit ; }

你可能感兴趣的:(C++Builder 截取图片)