image里有个图片,我怎样用鼠标框一块,然后将这个块保存起来??? 网上找了半天,没有解决, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 定位框的区域,然后copy出来到另一个image,然后savetofile to imho888() 你讲的我参照程序实现了现在就是想不用这样的方法to luxuewei5214(小卢)(以下内容仅供参考) 怎样定位框区域 to sdzeng(大头鸟) 怎样用鼠标选区需要截取的区域呢 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Image1: TImage; Button1: TButton; Image2: TImage; procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Image1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Button1Click(Sender: TObject); private { Private declarations } LeftTop,RightButtom : TPoint; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin LeftTop := Point(x,y);end;procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin RightButtom := Point(x,y); Image1.Canvas.Brush.Color := clBlack; Image1.Canvas.FrameRect(Rect(LeftTop,RightButtom));end;procedure TForm1.Button1Click(Sender: TObject);var Bitmap : TBitMap;begin if (LeftTop.X < RightButtom.X) and (LeftTop.Y < RightButtom.Y) then begin Bitmap := TBitmap.Create; Bitmap.Width := RightButtom.X-LeftTop.X; Bitmap.Height := RightButtom.Y-LeftTop.Y; Bitmap.PixelFormat := pf24Bit; Bitmap.Canvas.CopyRect( Rect(0,0,RightButtom.X-LeftTop.X,RightButtom.Y-LeftTop.Y), Image1.Canvas, Rect(LeftTop,RightButtom) ); Image2.Picture.Bitmap.Assign(Bitmap); Bitmap.Free; end;end;end. 如何使我的应用程序一直不失去焦点,除非退出程序?在线~~~~~~~~~~~~~~~急 在form中创建的动态按钮如何使用 怎样获得网络连接名称如“本地连接1“、“本地连接2”的本地连接号? 怎样添加一个全新的事件? 在WIN2000下新建用户 一个弄不懂的小小的但需要高手来回答的概念问题, (紧急求救)请问在Delphi中如何使用扫描枪取得条形码? 关于activexform 登陆窗体 在用语句删除表中的记录时,错误提示是"Token not found",请问大侠如何解决?谢谢 mapx中的的Symbol问题 郁闷,散分
你讲的我参照程序实现了现在就是想不用这样的方法to luxuewei5214(小卢)(以下内容仅供参考)
怎样定位框区域
怎样用鼠标选区需要截取的区域呢
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
Image2: TImage;
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
LeftTop,RightButtom : TPoint;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
LeftTop := Point(x,y);
end;procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
RightButtom := Point(x,y);
Image1.Canvas.Brush.Color := clBlack;
Image1.Canvas.FrameRect(Rect(LeftTop,RightButtom));
end;procedure TForm1.Button1Click(Sender: TObject);
var
Bitmap : TBitMap;
begin
if (LeftTop.X < RightButtom.X) and (LeftTop.Y < RightButtom.Y) then
begin
Bitmap := TBitmap.Create;
Bitmap.Width := RightButtom.X-LeftTop.X;
Bitmap.Height := RightButtom.Y-LeftTop.Y;
Bitmap.PixelFormat := pf24Bit;
Bitmap.Canvas.CopyRect(
Rect(0,0,RightButtom.X-LeftTop.X,RightButtom.Y-LeftTop.Y),
Image1.Canvas,
Rect(LeftTop,RightButtom)
);
Image2.Picture.Bitmap.Assign(Bitmap);
Bitmap.Free;
end;
end;end.