8
我有下面的過程允許從窗口中刪除文件,刪除工作得很好,但是當我在運行時使用(TStyleManager.TrySetStyle(styleName)
)更改樣式時,表單accept沒有更多的下降!這裏究竟有什麼不對?在運行時更改Delphi樣式不允許將文件刪除到表格
public //public section of the form
...
procedure AcceptFiles(var msg : TMessage); message WM_DROPFILES;
...
procedure TMainFrm.AcceptFiles(var msg: TMessage);
var
i,
fCount : integer;
aFileName : array [0..255] of char;
begin
// find out how many files the form is accepting
fCount := DragQueryFile(msg.WParam, {uses ShellApi is required...}
$FFFFFFFF,
acFileName,
255);
for I := 0 to fCount - 1 do
begin
DragQueryFile(msg.WParam, i, aFileName, 255);
if UpperCase(ExtractFileExt(aFileName)) = '.MSG' then //accept only .msg files
begin
if not itemExists(aFileName, ListBox1) then// function checks whether the file was already added to the listbox
begin
ListBox1.Items.Add(aFileName);
end
end;
end;
DragFinish(msg.WParam);
end;
...
procedure TMainFrm.FormCreate(Sender: TObject);
begin
DragAcceptFiles(Handle, True); //Main form accepts the dropped files
end;
+1 @hvd thaks你的答案!像魅力一樣工作 – Raul 2013-02-27 12:36:01
感謝編輯@TLama,同意這使得它更清晰。 – hvd 2013-02-27 19:12:24