home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / Delphi / User_vcl / All3222 / all.pas < prev    next >
Pascal/Delphi Source File  |  1996-10-06  |  17KB  |  565 lines

  1. {
  2.   Borland Delphi 2.0用のSusie32 Plug-In libraryを使ったコンポーネントALL32
  3.   Ver 2.2
  4.   by みけお (七田 隆司)
  5.   mikeo@airnet.or.jp
  6.   SGV02642@niftyserve.or.jp)
  7.  
  8.   機能
  9.   このコンポーネントはビットマップファイル(*.BMP)、アイコンファイル(*.ICO)、
  10.   メタファイル(*.WMF,*.EMF)、JPEGファイル(*.JPG,*.JPE)、GIFファイル(*.GIF)、
  11.   TIFFファイル(*.TIF)、PICファイル(*.PIC)、PICT2ファイル(*.P2)、
  12.   MAGファイル(*.MAG)、PIファイル(*.PI)、XLD4ファイル(*.Q4)に対応してい
  13.   ます。
  14.  
  15.   注意
  16.   これはDelphi1.0(J)では動作しません。
  17.   またOSはWindows95J、WindowsNTで動作確認しています。
  18.   減色処理をしていないので256色以下の環境では256色を超える画像を正しく表示でき
  19.   ません。
  20.   このプログラムはSusie32 Plug-in libraryを使用します。
  21.   Nifty Serve FWINMM LIB#5にSusie Plug-in libraryという名前で登録されています。
  22.   必要とするフォーマットが含まれているlibraryを取得してください。
  23.   Susie Plug-In libraryには32ビット版と16ビット版の2種類があるので注意して
  24.   下さい。
  25.  
  26.   まずはじめに
  27.   必要とするファイルはIFJPEG.SPI,IFGIF.SPI,IFTIFF.SPI,IFPI.SPI,IFMAG.SPI,
  28.   IFPIC.SPI,IFPIC2.SPI,IFXLD4.SPIの8つです。
  29.   このファイルをWindowsのSystemディレクトリにコピーして下さい。(ただし決して
  30.   使わないということが予めわかっていればそのSPIファイルはコピーする必要はあり
  31.   ません。)
  32.   イメージを表示や変更させる際にこのSPIファイルがないと'IFJPEG.SPI not found'
  33.   などというダイアログが表示されます。(ただしBMP,ICO,WMF,EMFファイルの場合は
  34.   プラグインを使いませんのでこのような表示はされません。)
  35.   
  36.   コンポーネントのインストールの方法
  37.   このAll.pasおよびAll.dcrを任意のディレクトリにコピーして下さい。
  38.   因みにAll.dcrファイルはコンポーネントのアイコンデータファイルです。
  39.   次に現在Delphiでプログラミング途中のものがあればメニューからファイル-全て
  40.   保存を実行してセーブしておくか、廃棄するかして下さい。廃棄するにはメニュー
  41.   からファイル-アプリケーションの新規作成を実行します。
  42.   次にメニューからコンポーネント-インストールを選択します。ここ出現するダイア
  43.   ログ上から追加ボタンを押しモジュールの追加というダイアログがでるので、参照ボタ
  44.   ンを押し、ALL.PASの場所に行きALL.PASをクリックし開くボタンを押します。
  45.   これでコンポーネントのインストールダイアログ上のインストールされたユニット
  46.   の中にallが含まれているはずです。OKボタンを押してダイアログから抜ければ
  47.   ALLが使えるようになります。
  48.  
  49.   コンポーネントのアンインストールの方法
  50.   現在プログラミング途中のものがあればセーブするなり廃棄するなりしておいて下
  51.   さい。
  52.   Delphi上でコンポーネント-インストールを選択し、ダイアログ上のインストール
  53.   されたユニットの中のAllを選択し、削除ボタンを押し、OKボタンを押します。
  54.   次にAll.pas,All.dcrやwindowsのsystemディレクトリにコピーしたSusie関係のSPI
  55.   ファイルを削除します。
  56.   
  57.   使用法
  58.   コンポーネントライブラリのSamplesページにAllの文字のアイコンで登録
  59.   されているはずなのでそれをフォームにおきます。
  60.   画像ファイルはString型PropertyのPictureNameの右をダブルクリックして
  61.   ダイアログ上で変更します。(設計時)
  62.  
  63.   プログラムでは例えば
  64.     All1.PictureName := 'BmpFile.BMP';
  65.     All1.PictureName := 'JpegFile.JPG';
  66.     All1.PictureName := 'JpegFile.JPE';
  67.     All1.PictureName := 'GifFile.GIF';
  68.     All1.PictureName := 'TiffFile.TIF';
  69.     All1.PictureName := 'IconFile.ICO';
  70.     All1.PictureName := 'MetaFile.WMF';
  71.     All1.PictureName := 'MetaFile.EMF';
  72.     All1.PictureName := 'MagFile.MAG';
  73.     All1.PictureName := 'PicFile.PIC';
  74.     All1.PictureName := 'Pic2File.P2';
  75.     All1.PictureName := 'PiFile.PI';
  76.     All1.PictureName := 'XLD4File.Q4';
  77.  
  78.   などのようにします。
  79.  
  80.   Jpegファイルのみの限定仕様
  81.     特殊機能としてプレビューというのがあり1/4の大きさで高速に表示します。
  82.     これを使うにはPreview PropertyをTrueにします。
  83.     またプレビューを使ったときにもとのサイズがわからないのでOrgWidth,OrgHeight
  84.     という2つのInteger型Propertyを用意しました。これはプログラム上でリードのみ
  85.     可能です。
  86.   その他の仕様
  87.     MACバイナリを含んだファイルに対応しています。(先頭の128バイトをカット
  88.     します。)
  89.     PICファイル、PIC2ファイルについてはアスペクト比を考慮するような仕様に
  90.     変更しました。
  91.   プロパティについて
  92.     Property PictureName:String (リード・ライト可能)
  93.       表示するファイル名をフルパスネームで指定します。
  94.       PictureNameを指定した後、表示に失敗した場合はこの値は''の値に戻ります。
  95.     Property Error:Integer      (リードオンリー)
  96.       PictureNameを指定した後、表示に失敗した場合には、エラー番号が入ります。
  97.       ほとんどがSusie Plug-Inと共通で、新たに追加したものは10:サポートされな
  98.       い拡張子、20:SPIファイルがないです。
  99.  
  100.   最後に
  101.   TImageを親としているため通常は必要のないPictureプロパティが残っています。
  102.   このためPicture Propertyの右や画像エリアををダブルクリックするとTImageと
  103.   全く同じでBMPファイルのロードができます。(あまり意味がない)
  104.   しかしこれを使うと画像ロード後にBMPファイルとしてセーブすることができます。
  105.   これには
  106.     All1.Picture.SaveToFile('BMPファイル名.BMP');
  107.   とします。
  108. }
  109.  
  110. unit all;
  111.  
  112. interface
  113.  
  114. uses
  115.   SysUtils, Windows, {Messages,} Classes, {Graphics,} {Controls,}
  116.   Forms, Dialogs, ExtCtrls, DsgnIntf;
  117.  
  118. type
  119.   TPictureName = String;
  120.   TPictureNameProperty = class(TStringProperty)
  121.   public
  122.     procedure Edit; override;
  123.     function GetAttributes: TPropertyAttributes; override;
  124.   end;
  125.  
  126.   TAll = class(TImage)
  127.     constructor Create(AOwner: TComponent); override;
  128.  
  129.   private
  130.     { Private declarations }
  131.     FPictureName:TPictureName;
  132.     FPreView:Boolean;
  133.     FOrgWidth:Integer;
  134.     FOrgHeight:Integer;
  135.     FError:Integer;
  136.     Sort:Integer;
  137.     {0:BMP,1:JPEG,2:GIF,3:TIFF,4:PIC,5:PIC2,6:MAG,7:XLD4,8:PI}
  138.     procedure SetFile(NewFileName:TPictureName);
  139.     procedure SetPreView(NewValue:Boolean);
  140.     procedure Disp;
  141.   protected
  142.     { Protected declarations }
  143.   public
  144.     { Public declarations }
  145.   published
  146.     { Published declarations }
  147.     property PictureName:TPictureName read FPictureName write SetFile;
  148.     property PreView:Boolean read FPreView write SetPreView;
  149.     property OrgWidth:Integer read FOrgWidth;
  150.     property OrgHeight:Integer read FOrgHeight;
  151.     property AutoSize default True;
  152.     property Error:Integer read FError;
  153.   end;
  154.  
  155. type
  156.   TPictureInfoPtr =  ^TPictureInfo;
  157.   TPictureInfo = record
  158.     Left,Top,Width,Height:LongInt;
  159.     x_density,y_density:WORD;
  160.     colorDepth:SmallInt;
  161.     hInfo:Integer;
  162.   end;
  163.   TBitmapInfoPtr = ^TBitmapInfo;
  164.  
  165. var
  166.   GetPictureInfo:
  167.     function(buf:PChar;len:Integer;flag:Integer;
  168.     pInfo:TPictureInfoPtr)
  169.     :Integer;stdcall;
  170.  
  171.   GetPicture:
  172.     function(buf:PChar;len:LongInt;flag:LongInt;
  173.     pHBInfo,pHBm:PHandle;lpPrgressCallback:TFarProc;lData:LongInt)
  174.     :Integer;stdcall;
  175.  
  176.   GetPreview:
  177.     function(buf:PChar;len:LongInt;flag:Integer;
  178.     pHBInfo,pHBm:PHandle;lpPrgressCallback:TFarProc;lData:LongInt)
  179.     :Integer;stdcall;
  180.  
  181. procedure Register;
  182.  
  183. implementation
  184.  
  185. {$R-}
  186. constructor TAll.Create(AOwner: TComponent);
  187. begin
  188.   inherited Create(AOwner);
  189.   AutoSize := True;
  190.   FPictureName := '';
  191. end;
  192.  
  193. procedure TAll.SetFile(NewFileName:TPictureName);
  194. begin
  195.   FPictureName := NewFileName;
  196.   if NewFileName = '' then
  197.   begin
  198.     FError := 0;
  199.     Picture.Bitmap := nil;
  200.     Exit;
  201.   end;
  202.   Picture.Bitmap := nil;
  203.   Disp;
  204. end;
  205.  
  206. procedure TAll.Disp;
  207. var
  208.   Ret:Integer;
  209.   hBData:THandle;
  210.   hBInfo:THandle;
  211.   pBData:Pointer;
  212.   pBInfo:Pointer;
  213.   Info:TPictureInfo;
  214.   Bitmap:TBitmap;
  215.   Bitmap2:TBitmap;
  216.   FName:array[0..255] of Char;
  217.   h:THandle;
  218.   pp:Pointer;
  219.   Err:String;
  220.   LogPalette:PLogPalette;
  221.   NumColor:Integer;
  222.   i:Integer;
  223.   hPal,hOldPal:THandle;
  224.   Bits:Integer;
  225.   Flag256:Boolean;
  226.   Base:TWinControl;
  227.   s:String;
  228.   MacBinOffset:Integer;
  229. begin
  230.   FError := 0;
  231.   s := UpperCase(ExtractFileExt(FPictureName));
  232.   if (s = '.BMP') or (s = '.ICO') or (s = '.WMF') or (s = '.EMF') then
  233.   begin
  234.     Sort := 0;
  235.     try
  236.       Picture.LoadFromFile(FPictureName);
  237.     except
  238.       on EInvalidGraphic do
  239.       begin
  240.         FError := 2;
  241.         Err := '未知のフォーマット';
  242.         ShowMessage(Format('%s [%s]',[Err,FPictureName]));
  243.         FPictureName := '';
  244.         Exit;
  245.       end;
  246.     end;
  247.   end
  248.   else if (s = '.JPG') or (s = '.JPE') then
  249.   begin
  250.     Sort := 1;
  251.     h := LoadLibrary('ifjpeg.spi');
  252.   end
  253.   else if s = '.GIF' then
  254.   begin
  255.     Sort := 2;
  256.     h := LoadLibrary('ifgif.spi');
  257.   end
  258.   else if s = '.TIF' then
  259.   begin
  260.     Sort := 3;
  261.     h := LoadLibrary('iftiff.spi');
  262.   end
  263.   else if s = '.PIC' then
  264.   begin
  265.     Sort := 4;
  266.     h := LoadLibrary('ifpic.spi');
  267.   end
  268.   else if s = '.P2' then
  269.   begin
  270.     Sort := 5;
  271.     h := LoadLibrary('ifpic2.spi');
  272.   end
  273.   else if s = '.MAG' then
  274.   begin
  275.     Sort := 6;
  276.     h := LoadLibrary('ifmag.spi');
  277.   end
  278.   else if s = '.Q4' then
  279.   begin
  280.     Sort := 7;
  281.     h := LoadLibrary('ifxld4.spi');
  282.   end
  283.   else if s = '.PI' then
  284.   begin
  285.     Sort := 8;
  286.     h := LoadLibrary('ifpi.spi');
  287.   end
  288.   else
  289.   begin
  290.     FError := 10; {サポートされない拡張子}
  291.     Err := 'サポートされない拡張子';
  292.     ShowMessage(Format('%s [%s]',[Err,FPictureName]));
  293.     FPictureName := '';
  294.     FPreView := False;
  295.     FOrgWidth := 0;
  296.     FOrgHeight := 0;
  297.     Exit;
  298.   end;
  299.   if (Sort<>1) then   { not Jpeg }
  300.   begin
  301.     FPreView := False;
  302.     FOrgWidth := 0;
  303.     FOrgHeight := 0;
  304.   end;
  305.  
  306.   if Sort = 0 then Exit;
  307.  
  308.   case Sort of
  309.     1:s:='JPG';
  310.     2:s:='GIF';
  311.     3:s:='TIFF';
  312.     4:s:='PIC';
  313.     5:s:='PIC2';
  314.     6:s:='MAG';
  315.     7:s:='XLD4';
  316.     8:s:='PI';
  317.   end;
  318.  
  319.   if h>HINSTANCE_ERROR then
  320.   begin
  321.     if (Sort = 1) or (Sort = 4) or (Sort = 5) then  {Jpeg or PIC or PIC2}
  322.     begin
  323.       pp := GetProcAddress(h,'GetPictureInfo');
  324.       if pp<>nil then
  325.         @GetPictureInfo := pp;
  326.       pp := GetProcAddress(h,'GetPreview');
  327.       if pp<>nil then
  328.         @GetPreview := pp;
  329.     end;
  330.     pp := GetProcAddress(h,'GetPicture');
  331.     if pp<>nil then
  332.       @GetPicture := pp;
  333.   end
  334.   else
  335.   begin
  336.     Err := 'IF'+s+'.SPI not found';
  337.     ShowMessage(Format('%s [%s]',[Err,FPictureName]));
  338.     FError := 20;  {SPIファイルがない}
  339.     FPictureName := '';
  340.     FreeLibrary(h);
  341.     Exit;
  342.   end;
  343.   StrPCopy(FName,FPictureName);
  344.  
  345.   if Sort = 1 then
  346.   begin
  347.     MacBinOffset := 0;
  348.     Ret := GetPictureInfo(FName,0,0,@Info);
  349.     if Ret <> 0 then
  350.     begin
  351.       Ret := GetPictureInfo(FName,128,0,@Info);
  352.       if Ret = 0 then
  353.         MacBinOffset := 128;
  354.     end;
  355.     if Ret <> 0 then
  356.     begin
  357.       FError := Ret;
  358.       case Ret of
  359.       2:Err := '未知のフォーマット';
  360.       3:Err := 'データが壊れている';
  361.       4:Err := 'メモリーが確保出来ない';
  362.       5:Err := 'メモリーエラー';
  363.       6:Err := 'ファイルリードエラー';
  364.       else
  365.         Err := 'その他のエラー';
  366.       end;
  367.       ShowMessage(Format('%s [%s]',[Err,FPictureName]));
  368.       FPictureName := '';
  369.       FreeLibrary(h);
  370.       Exit;
  371.     end;
  372.  
  373.     Bitmap := TBitmap.Create;
  374.     FOrgWidth := Info.Width;
  375.     FOrgHeight := Info.Height;
  376.     if FPreView then
  377.     begin
  378.       Bitmap.Width := Info.Width div 4;
  379.       if (Info.Width and 3)<>0 then Bitmap.Width := Bitmap.Width+1;
  380.       Bitmap.Height := Info.Height div 4;
  381.       if (Info.Height and 3)<>0 then Bitmap.Height := Bitmap.Height+1;
  382.     end
  383.     else
  384.     begin
  385.       Bitmap.Width := Info.Width;
  386.       Bitmap.Height := Info.Height;
  387.     end;
  388.  
  389.     GlobalFree(Info.hInfo);
  390.  
  391.     if FPreView then
  392.       Ret := GetPreview(@FName, MacBinOffset, 0, @hBInfo, @hBData, nil, 0)
  393.     else
  394.       Ret := GetPicture(@FName, MacBinOffset, 0, @hBInfo, @hBData, nil, 0);
  395.     pBData := GlobalLock(hBData);
  396.     pBInfo := GlobalLock(hBInfo);
  397.     SetDIBits(Canvas.Handle,Bitmap.Handle,
  398.       0,TBitmapInfoPtr(pBInfo)^.bmiHeader.biHeight,pBData,TBitmapInfoPtr(pBInfo)^,      DIB_RGB_COLORS);
  399.  
  400.     GlobalUnlock(hBData);
  401.     GlobalUnlock(hBInfo);
  402.     GlobalFree(hBData);
  403.     GlobalFree(hBInfo);
  404.     Picture.Graphic := Bitmap;
  405.     Bitmap.Free;
  406.     FreeLibrary(h);
  407.   end
  408.   else
  409.   begin
  410.     Ret := GetPicture(@FName, 0, 0, @hBInfo, @hBData, nil, 0);
  411.     if Ret = 2 then
  412.       Ret := GetPicture(@FName, 128, 0, @hBInfo, @hBData, nil, 0);
  413.     if Ret <> 0 then
  414.     begin
  415.       FError := Ret;
  416.       case Ret of
  417.       2:Err := '未知のフォーマット';
  418.       3:Err := 'データが壊れている';
  419.       4:Err := 'メモリーが確保出来ない';
  420.       5:Err := 'メモリーエラー';
  421.       6:Err := 'ファイルリードエラー';
  422.       else
  423.         Err := 'その他のエラー';
  424.       end;
  425.       ShowMessage(Format('%s [%s]',[Err,FPictureName]));
  426.       FPictureName := '';
  427.       FreeLibrary(h);
  428.       Exit;
  429.     end;
  430.     pBData := GlobalLock(hBData);
  431.     pBInfo := GlobalLock(hBInfo);
  432.     Bitmap := TBitmap.Create;
  433.     Bitmap.Width := TBitmapInfoPtr(pBInfo)^.bmiHeader.biWidth;
  434.     Bitmap.Height := TBitmapInfoPtr(pBInfo)^.bmiHeader.biHeight;
  435.     Bits := TBitmapInfoPtr(pBInfo)^.bmiHeader.biBitCount;
  436.     Flag256:=False;
  437.     h := GetDC(0);
  438.     if (Bits<=8) and (GetDeviceCaps(h,BitsPixel)=8) then
  439.       Flag256 := True;
  440.     ReleaseDC(0,h);
  441.     if Flag256 then
  442.     begin
  443.       NumColor := TBitmapInfoPtr(pBInfo)^.bmiHeader.biClrUsed;
  444.  
  445.       if NumColor = 0 then
  446.       begin
  447.         if Bits = 8 then NumColor := 256
  448.         else if Bits = 4 then NumColor := 16
  449.         else if Bits = 1 then NumColor := 2;
  450.       end;
  451.       LogPalette := AllocMem(4+NumColor*4);
  452.       with LogPalette^ do
  453.       begin
  454.         palVersion := $0300;
  455.         palNumEntries := NumColor;
  456.         for i:=0 to NumColor-1 do
  457.         begin
  458.           palPalEntry[i].peRed := TBitmapInfoPtr(pBInfo)^.bmiColors[i].rgbRed;
  459.           palPalEntry[i].peGreen := TBitmapInfoPtr(pBInfo)^.bmiColors[i].rgbGreen;
  460.           palPalEntry[i].peBlue := TBitmapInfoPtr(pBInfo)^.bmiColors[i].rgbBlue;
  461.           PalPalEntry[i].peFlags := 0;
  462.         end;
  463.       end;
  464.  
  465.       hPal := CreatePalette(LogPalette^);
  466.       hOldPal := SelectPalette(Canvas.Handle, hPal, false);
  467.       RealizePalette(Canvas.Handle);
  468.       Bitmap.Palette := hPal;
  469.       FreeMem(LogPalette);
  470.     end;
  471.     SetDIBits(Canvas.Handle,Bitmap.Handle,
  472.       0,TBitmapInfoPtr(pBInfo)^.bmiHeader.biHeight,pBData,TBitmapInfoPtr(pBInfo)^
  473.       ,DIB_RGB_COLORS);
  474.     GlobalUnlock(hBData);
  475.     GlobalUnlock(hBInfo);
  476.     GlobalFree(hBData);
  477.     GlobalFree(hBInfo);
  478.     Picture.Graphic := Bitmap;
  479.     if (Sort = 4) or (Sort = 5) then {PIC or PIC2 file}
  480.     begin
  481.       Ret := GetPictureInfo(FName,0,0,@Info);
  482.       if (Info.x_density<>1) or (Info.y_density<>1) then
  483.       begin
  484.         Bitmap2 := TBitmap.Create;
  485.         if Info.x_density < Info.y_density then
  486.         begin
  487.           Bitmap2.Height := Bitmap.Height;
  488.           Bitmap2.Width := Bitmap.Width * Info.y_density div Info.x_density;
  489.         end
  490.         else
  491.         begin
  492.           Bitmap2.Width := Bitmap.Width;
  493.           Bitmap2.Height := Bitmap.Height * Info.x_density div Info.y_density;
  494.         end;
  495.         Bitmap2.Canvas.StretchDraw(Rect(0,0,Bitmap2.Width,Bitmap2.Height),Bitmap);
  496.         Bitmap2.Palette := Bitmap.Palette;
  497.         Picture.Graphic := Bitmap2;
  498.         Bitmap2.Free;
  499.       end;
  500.     end;
  501.     Bitmap.Free;
  502.     if Flag256 then
  503.     begin
  504.       base := Parent;
  505.       while not((base is TForm) or (base=nil)) do
  506.         base := base.Parent;
  507.       if base is TForm then
  508.       begin
  509.         SelectPalette(TForm(base).Canvas.Handle, hPal, false);
  510.         RealizePalette(TForm(base).Canvas.Handle);
  511.         SelectPalette(TForm(base).Canvas.Handle,hOldPal, false);
  512.       end;
  513.     end;
  514.     FreeLibrary(h);
  515.   end;
  516. end;
  517.  
  518. procedure TAll.SetPreView(NewValue:Boolean);
  519. begin
  520.   FPreView := NewValue;
  521.   if FPictureName <> '' then
  522.     Disp;
  523. end;
  524.  
  525. procedure Register;
  526. begin
  527.   RegisterPropertyEditor(TypeInfo(TPictureName), TAll, 'PictureName', TPictureNameProperty);
  528.   RegisterComponents('Samples', [TAll]);
  529. end;
  530.  
  531. function TPictureNameProperty.GetAttributes: TPropertyAttributes;
  532. begin
  533.   Result := [paDialog];
  534. end;
  535.  
  536. procedure TPictureNameProperty.Edit;
  537. var
  538.   OpenDialog1:TOpenDialog;
  539.  
  540. begin
  541.   OpenDialog1 := TOpenDialog.Create(Application);
  542.   if Length(GetStrValue)<>0 then
  543.     OpenDialog1.InitialDir := ExtractFilePath(GetStrValue);
  544.   OpenDialog1.Filter := 'All files|*.BMP;*.JPG;*.JPE;*.GIF;*.TIF;'+
  545.   '*.ICO;*.WMF;*.EMF;*.PIC;*.P2;*.MAG;*.Q4;*.PI'+
  546.   '|Bmp file(*.BMP)|*.BMP'+
  547.   '|Jpeg file(*.JPG;*.JPE)|*.JPG;*.JPE'+
  548.   '|Gif file(*.GIF)|*.GIF'+
  549.   '|Tiff file(*.TIF)|*.TIF'+
  550.   '|PIC file(*.PIC)|*.PIC'+
  551.   '|PIC2 file(*.P2)|*.P2'+
  552.   '|MAG file(*.MAG)|*.MAG'+
  553.   '|XLD4 file(*.Q4)|*.Q4'+
  554.   '|PI file(*.PI)|*.PI'+
  555.   '|ICON file(*.ICO)|*.ICO'+
  556.   '|Meta file(*.WMF;*.EMF)|*.WMF;*.EMF';
  557.   OpenDialog1.FileName := GetStrValue;
  558.   if OpenDialog1.Execute then
  559.   begin
  560.     SetStrValue(OpenDialog1.FileName);
  561.   end;
  562. end;
  563.  
  564. end.
  565.