我编写代码实现图象的放大和缩小,结果是实现放大和缩小的功能了,但是缩小后图象中莫名其妙的多出了许多红点或者绿点,以下是源代码,谢谢var
rect1,rect2:TRect;
d:TBitmap;
begin  Form2.Image1.AutoSize:=false;
  Form2.Image1.Stretch:=false;
  SetStretchbltMode(BmpImage.Canvas.Handle,HALFTONE);
  SetBrushOrgEx(BmpImage.Canvas.Handle,0,0,nil);
  ntimes:=ntimes-1;  d:=Tbitmap.Create ;
  d.Width:=Round(TheOriginBmpImage.Width*IntPower(2,ntimes));
  d.Height:=Round(TheOriginBmpImage.Height*IntPower(2,ntimes));  rect2.Left:=0;
  rect2.Right:=d.Width-1;
  rect2.Top:=0;
  rect2.Bottom:=d.Height-1;
  rect1.Left:=0;
  rect1.Right:=TheOriginBmpImage.Width-1;
  rect1.Top:=0;
  rect1.Bottom:=TheOriginBmpImage.Height-1;
  BmpImage.Canvas.CopyRect(rect2,TheOriginBmpImage.Canvas,rect1);
  d.Canvas.CopyRect(rect2,TheOriginBmpImage.Canvas,rect1);
  Form2.Image1.Width:=d.Width;
  Form2.Image1.Height:=d.Height;
  Form2.Image1.Picture.Bitmap.Assign(d);
end;TheOriginBmpImage是原始没有放大或者缩小的图象