Results 1 to 11 of 11

Thread: SSTab array to add as many tabs as you want?

Hybrid View

  1. #1
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,909

    Re: SSTab array to add as many tabs as you want?

    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
    
    
    Name:  Image1.png
Views: 651
Size:  2.8 KB

    Name:  Image2.png
Views: 688
Size:  3.5 KB

    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.
    Attached Files Attached Files
    Last edited by Elroy; Sep 28th, 2017 at 01:12 PM.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width