📄 loadwin.pas
字号:
unit LoadWin;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls, FileCtrl;
type
TLoadForm = class(TForm)
DirectoryListBox1: TDirectoryListBox;
DriveComboBox1: TDriveComboBox;
FileEdit: TEdit;
FileListBox1: TFileListBox;
FilterComboBox1: TFilterComboBox;
Panel1: TPanel;
Image1: TImage;
m_butClose: TButton;
ViewBtn: TBitBtn;
LabelHeight: TLabel;
LabelWidth: TLabel;
LabelMMHeight: TLabel;
LabelMMWidth: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
procedure m_butCloseClick(Sender: TObject);
procedure FileListBox1Click(Sender: TObject);
procedure ViewBtnClick(Sender: TObject);
procedure FileEditKeyPress(Sender: TObject; var Key: Char);
procedure FormActivate(Sender: TObject);
procedure ViewFormInit;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
strSelectedDir : string;
strTempDir : string;
{ Public-Deklarationen }
end;
var
LoadForm: TLoadForm;
implementation
uses Viewwin, Imagewin;
{$R *.DFM}
procedure TLoadForm.m_butCloseClick(Sender: TObject);
begin
Close;
end;
procedure TLoadForm.FileListBox1Click(Sender: TObject);
var
FileExt: string[4];
strTmp1, strTmp2, strTmp3, strTmp4 : string;
begin
FileExt := AnsiUpperCase(ExtractFileExt(FileListBox1.Filename));
if (FileExt = '.WMF') or (FileExt = '.EMF') then begin
Image1.Picture.LoadFromFile(FileListBox1.Filename);
Str(Image1.Picture.Metafile.Height, strTmp1);
Str(Image1.Picture.Metafile.Width, strTmp2);
Str(Image1.Picture.Metafile.MMHeight, strTmp3);
Str(Image1.Picture.Metafile.MMWidth, strTmp4);
LabelHeight.Caption := strTmp1;
LabelWidth.Caption := strTmp2;
LabelMMHeight.Caption := strTmp3;
LabelMMWidth.Caption := strTmp4;
LabelWidth.Repaint;
LabelHeight.Repaint;
LabelMMWidth.Repaint;
LabelMMHeight.Repaint;
end;
end;
procedure TLoadForm.ViewFormInit;
begin
ViewForm.Image1.Picture.Metafile.Clear;
ViewForm.Image1.Picture.Metafile := Image1.Picture.Metafile;
ImageForm.nMetaWidth := Image1.Picture.Metafile.Width;
ImageForm.nMetaHeight := Image1.Picture.Metafile.Height;
ViewForm.HorzScrollBar.Range := Image1.Picture.Width;
ViewForm.VertScrollBar.Range := Image1.Picture.Height;
ViewForm.ClientHeight := Image1.Picture.Height;
ViewForm.ClientWidth := Image1.Picture.Width;
ViewForm.Caption := Caption;
ViewForm.Show;
end;
procedure TLoadForm.ViewBtnClick(Sender: TObject);
begin
ViewFormInit;
if (ImageForm.m_ComboBoxZoom.Text <> '100') then ImageForm.Zoom;
end;
procedure TLoadForm.FileEditKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then begin
FileListBox1.ApplyFilePath(FileEdit.Text);
Key := #0;
end;
end;
procedure TLoadForm.FormActivate(Sender: TObject);
begin
{$I-}
DriveComboBox1.Drive := (ExpandFileName(strSelectedDir))[1];
DirectoryListBox1.Directory := strSelectedDir;
if IOResult <> 0 then
MessageDlg('Temp-Verzeichnis nicht vorhanden', mtError, [mbOk], 0);
{$I+}
LabelHeight.Caption := '';
LabelWidth.Caption := '';
LabelMMHeight.Caption := '';
LabelMMWidth.Caption := '';
end;
procedure TLoadForm.Button1Click(Sender: TObject);
begin
strSelectedDir := DirectoryListBox1.Directory;
ImageForm.strSelectedDir := strSelectedDir;
ImageForm.m_DirectoryListBox.Directory := strSelectedDir;
ImageForm.m_DirectoryListBox.Update;
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -