M
minstrel
Unregistered / Unconfirmed
GUEST, unregistred user!
我看了Indy控件中的例子(I9D6_Demos_24Nov02)如下:
//添加附件
procedure TfrmMessageEditor.btnAttachmentClick(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
TIdAttachment.Create(IdMsgSend.MessageParts, OpenDialog1.FileName);
ResetAttachmentListView;
end;
end;
procedure TfrmMessageEditor.ResetAttachmentListView;
var li: TListItem;
idx: Integer;
begin
lvFiles.Items.Clear;
for idx := 0 to Pred(IdMsgSend.MessageParts.Count) do
begin
li := lvFiles.Items.Add;
if IdMsgSend.MessageParts.Items[idx] is TIdAttachment then
begin
li.ImageIndex := 0;
li.Caption := TIdAttachment(IdMsgSend.MessageParts.Items[idx]).Filename;
li.SubItems.Add(TIdAttachment(IdMsgSend.MessageParts.Items[idx]).ContentType);
end
else
begin
li.ImageIndex := 1;
li.Caption := IdMsgSend.MessageParts.Items[idx].ContentType;
end;
end;
怎样删除已经添加的附件了????盼望源代码,不胜感激!!
//添加附件
procedure TfrmMessageEditor.btnAttachmentClick(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
TIdAttachment.Create(IdMsgSend.MessageParts, OpenDialog1.FileName);
ResetAttachmentListView;
end;
end;
procedure TfrmMessageEditor.ResetAttachmentListView;
var li: TListItem;
idx: Integer;
begin
lvFiles.Items.Clear;
for idx := 0 to Pred(IdMsgSend.MessageParts.Count) do
begin
li := lvFiles.Items.Add;
if IdMsgSend.MessageParts.Items[idx] is TIdAttachment then
begin
li.ImageIndex := 0;
li.Caption := TIdAttachment(IdMsgSend.MessageParts.Items[idx]).Filename;
li.SubItems.Add(TIdAttachment(IdMsgSend.MessageParts.Items[idx]).ContentType);
end
else
begin
li.ImageIndex := 1;
li.Caption := IdMsgSend.MessageParts.Items[idx].ContentType;
end;
end;
怎样删除已经添加的附件了????盼望源代码,不胜感激!!