📄 gf_img.pas
字号:
{*******************************************************}
{ }
{ 票品图案 }
{ }
{ 中软金马公司版权所有。2002.12前 }
{ }
{ 编制:中软金马邮资票品项目开发组 }
{ }
{ }
{*******************************************************}
(*
省级集邮品,省级市场购入票,省级综合查询,省级系统管理
地市集邮品,地市市场购入票
*)
unit GF_img;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, Menus,dbtables,db;
type
TFrmf_img = class(TForm)
ScrollBox1: TScrollBox;
Image1: TImage;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure N1Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N2Click(Sender: TObject);
private
procedure SetPopupMU(ZoomType: integer = 0);
{ Private declarations }
public
vlpu_i_imgW: integer;
vlpu_i_imgH: integer;
{ Public declarations }
procedure SetImgView(blobField_ta: TBlobField; InitPos: integer=0);
end;
var
Frmf_img: TFrmf_img;
implementation
{$R *.DFM}
procedure TFrmf_img.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := cafree;
Frmf_img := nil;
end;
procedure TFrmf_img.N1Click(Sender: TObject);//zoom out
begin
ScrollBox1.ClientWidth := trunc(Image1.Width * 1.2);
ScrollBox1.ClientHeight := trunc(image1.Height * 1.2);
ClientWidth := ScrollBox1.Width;
ClientHeight := ScrollBox1.Height;
SetPopupMU;
end;
procedure TFrmf_img.N3Click(Sender: TObject);//
begin
ScrollBox1.ClientWidth := vlpu_i_imgW;
ScrollBox1.ClientHeight := vlpu_i_imgH;
ClientWidth := ScrollBox1.Width;
ClientHeight := ScrollBox1.Height;
SetPopupMU(1);
end;
procedure TFrmf_img.N2Click(Sender: TObject);
begin
ScrollBox1.ClientWidth := trunc(Image1.Width * 0.8);
ScrollBox1.ClientHeight := trunc(image1.Height * 0.8);
ClientWidth := ScrollBox1.Width;
ClientHeight := ScrollBox1.Height;
SetPopupMU;
end;
procedure TFrmf_img.SetPopupMU(ZoomType: integer = 0);
begin
N1.Enabled := ((ZoomType = 0) and (Width <=700) and (Height <= 500)) or (ZoomType = 1);
N2.Enabled := ((ZoomType = 0) and (Width >= 50) and (Height >=50)) or (ZoomType = 1);
end;
procedure TFrmf_img.SetImgView(blobField_ta: TBlobField; InitPos: integer=0);
var
Word_FileStream: TFileStream;
s: string;
begin
s := STRING(TBlobField(blobField_ta).asvariant);
if copy(s,1,2) = 'BM' then
begin
Word_FileStream:=TFileStream.Create('c:\1.bmp',fmOpenWrite or fmCreate);
Word_FileStream.Position:=0;
TBlobField(blobField_ta).SaveToStream(Word_FileStream);
Word_FileStream.Free;
Frmf_img.Image1.Picture.LoadFromFile('c:\1.bmp');
end
else
begin
Word_FileStream:=TFileStream.Create('c:\2.jpg',fmOpenWrite or fmCreate);
Word_FileStream.Position:=0;
TBlobField(blobField_ta).SaveToStream(Word_FileStream);
Word_FileStream.Free;
Frmf_img.Image1.Picture.LoadFromFile('c:\2.jpg');
end;
with Frmf_img do
begin
vlpu_i_imgW := Image1.Picture.Width;
vlpu_i_imgH := Image1.Picture.height;
ScrollBox1.ClientWidth := vlpu_i_imgW;
ScrollBox1.ClientHeight := vlpu_i_imgH;
ClientWidth := ScrollBox1.Width;
ClientHeight := ScrollBox1.Height;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -