Here, I did it for you just like you wanted:
Code:Option Explicit Private Sub Command1_Click() Dim iPicLeft As Long Dim iPicTop As Long ' ' We must save the top and left while the 0 tab is active. SSTabCtl.Tab = 0 iPicLeft = Picture1(0).Left iPicTop = Picture1(0).Top ' ' Now create the new tab and picturebox. SSTabCtl.Tabs = SSTabCtl.Tabs + 1 SSTabCtl.Tab = SSTabCtl.Tabs - 1 Load Picture1(SSTabCtl.Tabs - 1) Set Picture1(SSTabCtl.Tabs - 1).Container = SSTabCtl ' Now show on the current tab. Picture1(SSTabCtl.Tabs - 1).Left = iPicLeft Picture1(SSTabCtl.Tabs - 1).Top = iPicTop Picture1(SSTabCtl.Tabs - 1).Visible = True ' New controls are always hidden. End Sub
Project is attached.
Probably, the problem you were having is that your "master" picturebox wasn't just sitting on the form. It was already on the tab. When you change the active tab, you can no longer trust the .Left property of the picturebox on the first tab. And again, that's because the SSTab control isn't a series of containers. It's a single container that moves the controls around to create the illusion of multiple containers.




Reply With Quote
