Added NavigateToTabPage function to TabToListView

This commit is contained in:
Jaex 2016-04-30 00:42:48 +03:00
parent 341d430052
commit c1bd044ec0

View file

@ -141,15 +141,20 @@ private void lvMain_SelectedIndexChanged(object sender, EventArgs e)
{
ListViewItem lvi = lvMain.SelectedItems[0];
TabPage tabPage = lvi.Tag as TabPage;
NavigateToTabPage(tabPage);
}
}
if (tabPage != null && !tcMain.TabPages.Contains(tabPage))
{
tcMain.TabPages.Clear();
tcMain.TabPages.Add(tabPage);
// Need to set ImageKey again otherwise icon not show up
tabPage.ImageKey = lvi.ImageKey;
lvMain.Focus();
}
public void NavigateToTabPage(TabPage tabPage)
{
if (tabPage != null && !tcMain.TabPages.Contains(tabPage))
{
tcMain.TabPages.Clear();
tcMain.TabPages.Add(tabPage);
// Need to set ImageKey again otherwise icon not show up
tabPage.ImageKey = tabPage.ImageKey;
tabPage.Refresh();
lvMain.Focus();
}
}