这个想法是在双击时为包含主题、发件人和内容的电子邮件打开一个新的标签页MailList
。但它可以在第一次双击打开。:(
private void MailList_DoubleClick(object sender, EventArgs e)
{
TabPage newtab = new TabPage();
Mime m=EncodingMail(MailTree.SelectedNode.Text, MailList.FocusedItem.Text);
newtab.Text = m.MainEntity.Subject;
if (m.Attachments.Length == 0) attachmentTabPages2.Visible=false;
else
{
attachmentTabPages2.Visible = true;
for (int j = 0; j < m.Attachments.Count(); j++)
{
ListViewItem item1 = new ListViewItem();
item1.Text = m.Attachments[j].ContentDisposition_FileName;
attachmentTabPages2.Items.Add(item1);
}
}
//ListViewItem item = sender as ListViewItem;
webBrowser2.DocumentText = m.BodyHtml;
FromTabPage2.Text="From: " + m.MainEntity.From.ToAddressListString();
ToTabPages2.Text = "To: " + m.MainEntity.To.ToAddressListString();
SubjectTabPage2.Text = "Subject: " + m.MainEntity.Subject;
DateTimeTabPages2.Text = "Date: " + m.MainEntity.Date.ToShortDateString();
foreach (Control control in tabPage2.Controls)
{
newtab.Controls.Add(control);
}
Acc1Tab.TabPages.Add(newtab);
Acc1Tab.SelectedTab = newtab;
}