C# 添加新选项卡页问题
这个想法是在双击C# 添加新选项卡页问题,c#,winforms,tabpage,C#,Winforms,Tabpage,这个想法是在双击邮件列表时,为电子邮件打开一个新的标签页,其中包含主题、发件人和内容。但它可以在第一次双击时打开:( private void邮件列表\u双击(对象发送者,事件参数e) { TabPage newtab=新TabPage(); Mime m=编码邮件(MailTree.SelectedNode.Text,MailList.FocusedItem.Text); newtab.Text=m.maintentity.Subject; 如果(m.Attachments.Length==0
邮件列表时,为电子邮件打开一个新的标签页,其中包含主题、发件人和内容。但它可以在第一次双击时打开:(
private void邮件列表\u双击(对象发送者,事件参数e)
{
TabPage newtab=新TabPage();
Mime m=编码邮件(MailTree.SelectedNode.Text,MailList.FocusedItem.Text);
newtab.Text=m.maintentity.Subject;
如果(m.Attachments.Length==0)attachmentTabPages2.Visible=false;
其他的
{
attachmentTabPages2.Visible=true;
对于(int j=0;j
同一用户可能重复的小进度,您不能将控件添加到多个选项卡页。
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;
}