W
wenqy
Unregistered / Unconfirmed
GUEST, unregistred user!
[][8D][!]我作了一个极简单的屏保预览,按下Button后,用OpenDialog选择到屏保程序,在edit显示路径的同时,应该在Panel上开始预览,但不知为何没有响应?<br>原码如下:<br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls, ExtCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Panel1: TPanel;<br> Edit1: TEdit;<br> Button1: TButton;<br> OpenDialog1: TOpenDialog;<br> procedure Button1Click(Sender: TObject);<br> procedure Edit1Change(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Edit1Change(Sender: TObject);<br> begin<br>WinExec(Pchar(Edit1.Text+'/p'+IntToStr(Panel1.Handle)),SW_SHOW);<br> end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> opendialog1.InitialDir:='C:/windows/';<br>if OpenDialog1.Execute then<br> begin<br> Edit1.Text:=OpenDialog1.FileName;<br> end;<br>end;<br>end.<br>