LoadWin.pas
上传用户:yuandong
上传日期:2022-08-08
资源大小:954k
文件大小:3k
- 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;
- 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;
- private
- { Private-Deklarationen }
- public
- 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;
- ImageForm.m_labelFileName.Caption := Copy(ExtractFileName(FileListBox1.Filename), 1, Pos('.', ExtractFileName(FileListBox1.Filename))-1);
- ImageForm.m_labelFileName.Refresh;
- 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(strTempDir))[1];
- DirectoryListBox1.Directory := strTempDir;
- if IOResult <> 0 then
- MessageDlg('Temp-Verzeichnis nicht vorhanden', mtError, [mbOk], 0);
- {$I+}
- LabelHeight.Caption := '';
- LabelWidth.Caption := '';
- LabelMMHeight.Caption := '';
- LabelMMWidth.Caption := '';
- end;
- end.