⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmimage.pas

📁 一套圖書管理程序
💻 PAS
字号:
unit frmImage;

interface

uses Windows, Classes, Graphics, Forms, Controls,
  FileCtrl, StdCtrls, ExtCtrls, Buttons, Spin, ComCtrls, Dialogs;

type
  TImageForm = class(TForm)
    DirectoryListBox1: TDirectoryListBox;
    DriveComboBox1: TDriveComboBox;
    FileEdit: TEdit;
    Panel1: TPanel;
    Image1: TImage;
    FileListBox1: TFileListBox;
    Bevel1: TBevel;
    FilterComboBox1: TFilterComboBox;
    StretchCheck: TCheckBox;
    Button1: TButton;
    Button2: TButton;
    Label1:Tlabel;
    Label2: TLabel;
    procedure FileListBox1Click(Sender: TObject);
    procedure StretchCheckClick(Sender: TObject);
    procedure FileEditKeyPress(Sender: TObject; var Key: Char);
  public
    ImgFileName:string;
  private
     FormCaption:string;
  end;



implementation

uses  SysUtils;

{$R *.DFM}

procedure TImageForm.FileListBox1Click(Sender: TObject);
var
  FileExt: string[4];
begin
  FileExt := AnsiUpperCase(ExtractFileExt(FileListBox1.Filename));
  if (FileExt = '.BMP') or (FileExt = '.ICO') or (FileExt = '.WMF') or
    (FileExt = '.EMF') then
  begin
    Image1.Picture.LoadFromFile(FileListBox1.Filename);
    if  (Image1.Picture.Width>300) or  (Image1.Picture.Height>430) then
      application.MessageBox('图片尺寸超过300*430,请调整图片大小后再输入!','操作提示',MB_OK)
    else
    begin
      ImgFileName:=FileListBox1.Filename;
      label2.caption := FormCaption + ExtractFilename(FileListBox1.Filename);
      if (FileExt = '.BMP') then
      begin
        label2.caption := label2.caption +
          Format(' (%d x %d)', [Image1.Picture.Width, Image1.Picture.Height]);

      end
      else
      if FileExt = '.ICO' then
      begin
        Icon := Image1.Picture.Icon;
      end;
      if (FileExt = '.WMF') or (FileExt = '.EMF') then
    end;
  end;
end;

procedure TImageForm.StretchCheckClick(Sender: TObject);
begin
  Image1.Stretch :=StretchCheck.Checked;
end;

procedure TImageForm.FileEditKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then 
  begin
    FileListBox1.ApplyFilePath(FileEdit.Text);
    Key := #0;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -