線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:972
推到 Plurk!
推到 Facebook!

請問如何更新 Panel ?

缺席
pcboy
版主


發表:177
回覆:1838
積分:1463
註冊:2004-01-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-11-21 15:30:39 IP:219.87.xxx.xxx 訂閱
 
在 Panel1 上放 FileListBox1 和 ListBox1 , 在選擇別的 scr (螢幕保護程式) 時候, 結果每個螢幕保護程式都出現在 Panel2 , 請問該如何解決 ?
<textarea class="delphi" rows="10" cols="60" name="code"> unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, FileCtrl, ExtCtrls, Menus; type TForm1 = class(TForm) Panel1: TPanel; Panel2: TPanel; FileListBox1: TFileListBox; ListBox1: TListBox; procedure FormCreate(Sender: TObject); procedure FileListBox1DblClick(Sender: TObject); procedure FormHide(Sender: TObject); procedure Fresh1; private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function EnumProc( h : HWND ;// handle of child window l : integer// application-defined value ): boolean;stdcall; var buf : array[0..255] of char; begin GetWindowText(h, buf, sizeof(buf)- 1); if iswindowvisible(h) then Form1.ListBox1.items.add(' ' strpas(buf) ' : ' inttostr(h)) else Form1.ListBox1.items.add('-' strpas(buf) ' : ' inttostr(h)); Result := true; end; procedure TForm1.Fresh1; begin ListBox1.Clear; // 失效 ??? Why ? enumChildwindows(Panel2.handle, TFNWndEnumProc(@enumproc), 0); Panel1.RePaint; // 失效 ??? Why ? end; procedure TForm1.FormCreate(Sender: TObject); var buf : array[0..256] of char; begin FileListBox1.Mask:='*.scr'; GetSystemDirectory(buf, sizeof(buf) - 1); FileListBox1.directory := strpas(buf); end; procedure TForm1.FileListBox1DblClick(Sender: TObject); begin WinExec(pchar(FileListBox1.FileName ' /p ' inttostr(Panel2.handle)), SW_Show); Fresh1; end; procedure TForm1.FormHide(Sender: TObject); var h : integer; s : string; begin if ListBox1.itemindex = -1 then exit; s := Listbox1.items[ListBox1.itemindex]; h := strtoint(copy(s, pos(':', s) 1, length(s))); ShowWindow(h, SW_HIDE); Fresh1; end; end. </textarea>

------
能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案!

子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問!
系統時間:2024-05-17 11:09:58
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!