就是一个颜色的种子填充问题你可以用GR32_SeedFill单元找出相应颜色的区域然后标识出区域就可以了可以给一段代码给你看一下其中CreateRegion函数是一个用指定图形的指定颜色建立一个区域procedure TMarchimage32.MagicMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);var SeedBmp: TSeedFill; DestBmp, SoureceBmp: TBitmap32; Bit: PColor32; Value: byte; Ptr: PByte; i, j: Integer; TempBmp: TBitmap; fileStream: TStream; BoundRgn: Hrgn;begin ChkDraw := False; if FRectMode = mmMove then begin if not ChkMove then begin DeleteObject(DrawHrgn); DrawHrgn := 0; end; ChkMove := False; FRectMode := mmNew; end else begin if Self.ScaleMode = smScale then begin SoureceBmp := TBitmap32.Create; SoureceBmp.SetSize(Trunc(Self.Bitmap.Width * Self.Scale), Trunc(Self.Bitmap.Height * Self.Scale)); SoureceBmp.Clear(clBlack32); Self.Bitmap.DrawMode := dmBlend; Self.Bitmap.DrawTo(SoureceBmp, SoureceBmp.ClipRect, Self.Bitmap.ClipRect); SeedBmp := TSeedFill.Create(SoureceBmp); end else SeedBmp := TSeedFill.Create(Self.Bitmap); SeedBmp.Min := Trunc(FTolerance / 100 * 255); SeedBmp.Max := SeedBmp.Min; X := (X div FCompartmentWidth) * FCompartmentWidth; Y := (Y div FCompartmentWidth) * FCompartmentWidth; SeedBmp.SetFillPoint(X, Y); SeedBmp.Update; DestBmp := TBitmap32.Create; if Self.ScaleMode = smScale then DestBmp.SetSize(SoureceBmp.Width, SoureceBmp.Height) else DestBmp.SetSize(Self.Bitmap.Width, Self.Bitmap.Height); Bit := @DestBmp.Bits[0]; for j := 0 to DestBmp.Height - 1 do for i := 0 to DestBmp.Width - 1 do begin Ptr := SeedBmp.ToleranceMaskPtr[i, j]; Value := Ptr^; Bit^ := $FF000000 or (Value shl 16) or (Value shl 8) or Value; Inc(Bit); end; SeedBmp.free; fileStream := TMemoryStream.Create; DestBmp.SaveToStream(fileStream); fileStream.Position := 0; TempBmp := TBitmap.Create; TempBmp.LoadFromStream(fileStream); fileStream.free; DestBmp.free; CurrHrgn := CreateRegion(TempBmp, clBlack, Handle); TempBmp.free; if Self.ScaleMode = smScale then SoureceBmp.free; if DrawHrgn <> 0 then begin DeleteObject(DrawHrgn); DrawHrgn := 0; end; DrawHrgn := CreateRectRgnIndirect(Rect(0, 0, 0, 0)); CombineRgn(DrawHrgn, DrawHrgn, CurrHrgn, RGN_OR); DeleteObject(CurrHrgn); CurrHrgn := 0; end; RemoveCursorRestrictions; RemoveBmp; if DrawHrgn <> 0 then begin BoundRgn := CreateRectRgnIndirect(Self.ClientRect); CombineRgn(DrawHrgn, DrawHrgn, BoundRgn, RGN_AND); DeleteObject(BoundRgn); ShowHrgn(DrawHrgn); end;end;