demoform.pas

来自「含有七个函数」· PAS 代码 · 共 64 行

PAS
64
字号
unit demoform;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, FileCtrl;

type
  TForm1 = class(TForm)
    Button1: TButton;
    FileListBox1: TFileListBox;
    DirectoryListBox1: TDirectoryListBox;
    DriveComboBox1: TDriveComboBox;
    FilterComboBox1: TFilterComboBox;
    ScrollBox1: TScrollBox;
    Image1: TImage;
    SaveDialog1: TSaveDialog;
    procedure FileListBox1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

function WyLoadImage(FileName: PChar): HBitmap; stdcall;
  external 'JpegLib';

function WySaveJpg(FileName: PChar;Quality:integer;Gray: Boolean):boolean; stdcall;
  external 'JpegLib';

implementation

{$R *.DFM}

procedure TForm1.FileListBox1Click(Sender: TObject);
var
  s: string;
begin
  s := FileListBox1.FileName;
{   if UpperCase(ExtractFileExt(s))='.JPG' then
     Image1.Picture.Bitmap.Handle := WyLoadJpg(PChar(s), False);
   if UpperCase(ExtractFileExt(s))='.GIF' then
   begin
     Image1.Picture.Bitmap.Handle:=WyLoadGIF(PChar(s));
     form1.Caption:=inttostr(WyReadAniGIFInfo(PChar(s)));
   end;}
   Image1.Picture.Bitmap.Handle := WyLoadImage(PChar(s));
   image1.AutoSize:=true;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
    WySaveJpg(PChar(savedialog1.FileName),70, True);
end;


end.

⌨️ 快捷键说明

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