Added AutoSelectChild option to TabToTreeView control

This commit is contained in:
Jaex 2020-02-04 15:43:16 +03:00
parent 9b02aadf8d
commit 1331822677
4 changed files with 7813 additions and 1354 deletions

View file

@ -94,6 +94,9 @@ public ImageList ImageList
}
}
[DefaultValue(false)]
public bool AutoSelectChild { get; set; }
public TabToTreeView()
{
InitializeComponent();
@ -140,7 +143,15 @@ private void tvMain_BeforeCollapse(object sender, TreeViewCancelEventArgs e)
private void tvMain_AfterSelect(object sender, TreeViewEventArgs e)
{
TabPage tabPage = e.Node.Tag as TabPage;
SelectTab(tabPage);
if (AutoSelectChild && tabPage.Controls.Count == 1 && tabPage.Controls[0] is TabControl)
{
SelectChild();
}
else
{
SelectTab(tabPage);
}
}
public void SelectTab(TabPage tabPage)

View file

@ -4854,13 +4854,13 @@ private void InitializeComponent()
//
// tttvMain
//
this.tttvMain.AutoSelectChild = true;
resources.ApplyResources(this.tttvMain, "tttvMain");
this.tttvMain.ImageList = null;
this.tttvMain.MainTabControl = null;
this.tttvMain.Name = "tttvMain";
this.tttvMain.TreeViewFont = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.tttvMain.TreeViewSize = 210;
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
//
// actRapidShareAccountType
//

View file

@ -140,14 +140,6 @@ private void AddIconToTabs()
}
}
private void tttvMain_TabChanged(TabPage tabPage)
{
if (tabPage == tpImageUploaders || tabPage == tpTextUploaders || tabPage == tpFileUploaders || tabPage == tpURLShorteners || tabPage == tpOtherUploaders)
{
tttvMain.SelectChild();
}
}
public void NavigateToTabPage(TabPage tp)
{
if (tp != null)

File diff suppressed because it is too large Load diff