home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / dialog / vbtabdlg / vbtabdlg.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-18  |  14.3 KB  |  441 lines

  1. VERSION 2.00
  2. Begin Form frmConfig 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Simple Visual Basic tabbed dialog demo"
  6.    ClientHeight    =   5925
  7.    ClientLeft      =   1860
  8.    ClientTop       =   1740
  9.    ClientWidth     =   8100
  10.    Height          =   6330
  11.    Left            =   1800
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5925
  16.    ScaleWidth      =   8100
  17.    Top             =   1395
  18.    Width           =   8220
  19.    Begin PictureBox picTab 
  20.       BackColor       =   &H00C0C0C0&
  21.       Height          =   3000
  22.       Index           =   2
  23.       Left            =   7020
  24.       ScaleHeight     =   2970
  25.       ScaleWidth      =   5805
  26.       TabIndex        =   11
  27.       Top             =   1530
  28.       Width           =   5835
  29.       Visible         =   0   'False
  30.       Begin Frame Frame3 
  31.          BackColor       =   &H00C0C0C0&
  32.          Caption         =   "Frame3"
  33.          Height          =   1095
  34.          Left            =   315
  35.          TabIndex        =   12
  36.          Top             =   1530
  37.          Width           =   5250
  38.       End
  39.       Begin Frame Frame2 
  40.          BackColor       =   &H00C0C0C0&
  41.          Caption         =   "Frame2"
  42.          Height          =   1065
  43.          Left            =   315
  44.          TabIndex        =   13
  45.          Top             =   285
  46.          Width           =   5235
  47.          Begin OptionButton Option2 
  48.             BackColor       =   &H00C0C0C0&
  49.             Caption         =   "Option2"
  50.             Height          =   330
  51.             Left            =   2910
  52.             TabIndex        =   15
  53.             Top             =   435
  54.             Width           =   1920
  55.          End
  56.          Begin OptionButton Option1 
  57.             BackColor       =   &H00C0C0C0&
  58.             Caption         =   "Option1"
  59.             Height          =   360
  60.             Left            =   630
  61.             TabIndex        =   16
  62.             Top             =   435
  63.             Width           =   1875
  64.          End
  65.       End
  66.    End
  67.    Begin PictureBox picTab 
  68.       BackColor       =   &H00C0C0C0&
  69.       Height          =   3000
  70.       Index           =   3
  71.       Left            =   1170
  72.       ScaleHeight     =   2970
  73.       ScaleWidth      =   5805
  74.       TabIndex        =   14
  75.       Top             =   990
  76.       Width           =   5835
  77.       Visible         =   0   'False
  78.       Begin Timer Timer1 
  79.          Interval        =   1000
  80.          Left            =   4440
  81.          Top             =   1710
  82.       End
  83.       Begin Label Label5 
  84.          BackColor       =   &H00C0C0C0&
  85.          Caption         =   "January 16, 1996"
  86.          Height          =   285
  87.          Left            =   3735
  88.          TabIndex        =   9
  89.          Top             =   720
  90.          Width           =   1575
  91.       End
  92.       Begin Label Label4 
  93.          BackColor       =   &H00C0C0C0&
  94.          Caption         =   "e-mail: ahto.taig@online.ee"
  95.          Height          =   270
  96.          Left            =   2880
  97.          TabIndex        =   10
  98.          Top             =   435
  99.          Width           =   2430
  100.       End
  101.       Begin Label lblImportant 
  102.          BackColor       =   &H00C0C0C0&
  103.          Caption         =   "STOP RUSSIAN INVASION IN CHECHNYA!"
  104.          FontBold        =   -1  'True
  105.          FontItalic      =   0   'False
  106.          FontName        =   "MS Sans Serif"
  107.          FontSize        =   22.5
  108.          FontStrikethru  =   0   'False
  109.          FontUnderline   =   0   'False
  110.          ForeColor       =   &H000000FF&
  111.          Height          =   2160
  112.          Left            =   465
  113.          TabIndex        =   18
  114.          Top             =   675
  115.          Width           =   3330
  116.       End
  117.       Begin Label Label2 
  118.          BackColor       =   &H00C0C0C0&
  119.          Caption         =   "this demo by Ahto Tanner, Estonia"
  120.          Height          =   300
  121.          Left            =   2265
  122.          TabIndex        =   17
  123.          Top             =   135
  124.          Width           =   3060
  125.       End
  126.    End
  127.    Begin PictureBox picTab 
  128.       BackColor       =   &H00C0C0C0&
  129.       Height          =   3000
  130.       Index           =   1
  131.       Left            =   6540
  132.       ScaleHeight     =   2970
  133.       ScaleWidth      =   5805
  134.       TabIndex        =   8
  135.       Top             =   420
  136.       Width           =   5835
  137.       Visible         =   0   'False
  138.       Begin CheckBox Check3 
  139.          BackColor       =   &H00C0C0C0&
  140.          Caption         =   "Check3"
  141.          Height          =   405
  142.          Left            =   630
  143.          TabIndex        =   24
  144.          Top             =   1725
  145.          Width           =   2550
  146.       End
  147.       Begin CheckBox Check2 
  148.          BackColor       =   &H00C0C0C0&
  149.          Caption         =   "Check2"
  150.          Height          =   405
  151.          Left            =   630
  152.          TabIndex        =   23
  153.          Top             =   1140
  154.          Width           =   2535
  155.       End
  156.       Begin CheckBox Check1 
  157.          BackColor       =   &H00C0C0C0&
  158.          Caption         =   "Check1"
  159.          Height          =   390
  160.          Left            =   630
  161.          TabIndex        =   22
  162.          Top             =   525
  163.          Width           =   2490
  164.       End
  165.       Begin CommandButton Command1 
  166.          Caption         =   "Command1"
  167.          Height          =   495
  168.          Left            =   3645
  169.          TabIndex        =   21
  170.          Top             =   1980
  171.          Width           =   1710
  172.       End
  173.    End
  174.    Begin PictureBox picTab 
  175.       BackColor       =   &H00C0C0C0&
  176.       Height          =   3000
  177.       Index           =   0
  178.       Left            =   255
  179.       ScaleHeight     =   2970
  180.       ScaleWidth      =   5805
  181.       TabIndex        =   7
  182.       Top             =   660
  183.       Width           =   5835
  184.       Begin Frame Frame1 
  185.          BackColor       =   &H00C0C0C0&
  186.          Caption         =   "Frame1"
  187.          Height          =   2595
  188.          Left            =   180
  189.          TabIndex        =   19
  190.          Top             =   165
  191.          Width           =   5385
  192.          Begin Label Label3 
  193.             BackColor       =   &H00C0C0C0&
  194.             Caption         =   "The explanation of this demo is in Form_Load procedure of this form"
  195.             FontBold        =   -1  'True
  196.             FontItalic      =   0   'False
  197.             FontName        =   "MS Sans Serif"
  198.             FontSize        =   15
  199.             FontStrikethru  =   0   'False
  200.             FontUnderline   =   0   'False
  201.             ForeColor       =   &H0000FFFF&
  202.             Height          =   1335
  203.             Left            =   390
  204.             TabIndex        =   20
  205.             Top             =   660
  206.             Width           =   4590
  207.          End
  208.       End
  209.    End
  210.    Begin CommandButton butHelp 
  211.       Caption         =   "&Help"
  212.       Height          =   405
  213.       Left            =   150
  214.       TabIndex        =   2
  215.       Top             =   3915
  216.       Width           =   1200
  217.    End
  218.    Begin CommandButton butCancel 
  219.       Cancel          =   -1  'True
  220.       Caption         =   "C&ancel"
  221.       Height          =   405
  222.       Left            =   5025
  223.       TabIndex        =   1
  224.       Top             =   3915
  225.       Width           =   1200
  226.    End
  227.    Begin CommandButton butOK 
  228.       Caption         =   "&OK"
  229.       Default         =   -1  'True
  230.       Height          =   405
  231.       Left            =   3780
  232.       TabIndex        =   0
  233.       Top             =   3915
  234.       Width           =   1200
  235.    End
  236.    Begin Line linHor1 
  237.       X1              =   150
  238.       X2              =   6210
  239.       Y1              =   3825
  240.       Y2              =   3825
  241.    End
  242.    Begin Line linHor2 
  243.       BorderColor     =   &H00808080&
  244.       BorderWidth     =   2
  245.       X1              =   195
  246.       X2              =   6180
  247.       Y1              =   3795
  248.       Y2              =   3810
  249.    End
  250.    Begin Line linVert3 
  251.       BorderColor     =   &H00808080&
  252.       BorderWidth     =   2
  253.       X1              =   6195
  254.       X2              =   6195
  255.       Y1              =   645
  256.       Y2              =   3810
  257.    End
  258.    Begin Line linVert2 
  259.       BorderColor     =   &H00FFFFFF&
  260.       BorderWidth     =   2
  261.       X1              =   180
  262.       X2              =   180
  263.       Y1              =   585
  264.       Y2              =   3795
  265.    End
  266.    Begin Line linVert4 
  267.       X1              =   6210
  268.       X2              =   6210
  269.       Y1              =   645
  270.       Y2              =   3840
  271.    End
  272.    Begin Line linVert1 
  273.       X1              =   150
  274.       X2              =   150
  275.       Y1              =   645
  276.       Y2              =   3825
  277.    End
  278.    Begin Label lblTab 
  279.       BackColor       =   &H8000000F&
  280.       BackStyle       =   0  'Transparent
  281.       BorderStyle     =   1  'Fixed Single
  282.       Height          =   360
  283.       Index           =   3
  284.       Left            =   4740
  285.       TabIndex        =   6
  286.       Top             =   180
  287.       Width           =   1455
  288.    End
  289.    Begin Label lblTab 
  290.       BackColor       =   &H8000000F&
  291.       BackStyle       =   0  'Transparent
  292.       BorderStyle     =   1  'Fixed Single
  293.       Height          =   360
  294.       Index           =   2
  295.       Left            =   3225
  296.       TabIndex        =   5
  297.       Top             =   180
  298.       Width           =   1455
  299.    End
  300.    Begin Label lblTab 
  301.       BackColor       =   &H8000000F&
  302.       BackStyle       =   0  'Transparent
  303.       BorderStyle     =   1  'Fixed Single
  304.       Height          =   360
  305.       Index           =   1
  306.       Left            =   1695
  307.       TabIndex        =   4
  308.       Top             =   195
  309.       Width           =   1470
  310.    End
  311.    Begin Label lblTab 
  312.       BackColor       =   &H8000000F&
  313.       BackStyle       =   0  'Transparent
  314.       BorderStyle     =   1  'Fixed Single
  315.       Height          =   360
  316.       Index           =   0
  317.       Left            =   210
  318.       TabIndex        =   3
  319.       Top             =   210
  320.       Width           =   1410
  321.    End
  322.    Begin Image imgTab 
  323.       Height          =   480
  324.       Index           =   3
  325.       Left            =   480
  326.       Picture         =   VBTABDLG.FRX:0000
  327.       Top             =   4980
  328.       Width           =   6075
  329.       Visible         =   0   'False
  330.    End
  331.    Begin Image imgTab 
  332.       Height          =   495
  333.       Index           =   2
  334.       Left            =   300
  335.       Picture         =   VBTABDLG.FRX:338A
  336.       Top             =   4725
  337.       Width           =   6075
  338.       Visible         =   0   'False
  339.    End
  340.    Begin Image imgTab 
  341.       Height          =   495
  342.       Index           =   1
  343.       Left            =   150
  344.       Picture         =   VBTABDLG.FRX:68AC
  345.       Top             =   4500
  346.       Width           =   6075
  347.       Visible         =   0   'False
  348.    End
  349.    Begin Image imgTab 
  350.       Height          =   495
  351.       Index           =   0
  352.       Left            =   150
  353.       Picture         =   VBTABDLG.FRX:9DCE
  354.       Top             =   165
  355.       Width           =   6075
  356.    End
  357. Option Explicit
  358. Sub butCancel_Click ()
  359.     Unload Me
  360. End Sub
  361. Sub butOK_Click ()
  362.      Unload Me
  363. End Sub
  364. Sub Form_Load ()
  365. Dim i As Integer
  366.     ' center form
  367.     Me.Move screen.Width \ 2 - Me.Width \ 2, screen.Height \ 2 - Me.Height \ 2
  368.     LastActiveTab = 0
  369.     ' with each panel 0 to 3 do next
  370.     For i = 0 To 3
  371.     ' move each tab image to the same location as imgTab(0)
  372.     imgTab(i).Move imgTab(0).Left, imgTab(0).Top
  373.     ' move each panel to the same location as picTab(0)
  374.     picTab(i).Move picTab(0).Left, picTab(0).Top
  375.     ' hide borders of tab labels
  376.     lblTab(i).BorderStyle = 0
  377.     ' hide borders of each panel
  378.     picTab(i).BorderStyle = 0
  379.     Next i
  380.     ' show this tab that user viewed last
  381.     ' ActiveTab is declared as global var in BAS file
  382.     Call lblTab_click(ActiveTab)
  383.     ' Hi!
  384.     '
  385.     ' Here is a little example how to create simple tabbed dialog
  386.     ' like ones in Word or Excel and many other Windows programs.
  387.     ' The biggest problem here is to make bitmaps for each tab header
  388.     ' you want to display. This is simple, if you can use any
  389.     ' shareware TabDlg VBXs "in demo mode" to create sample dialog
  390.     ' and then capture it's image. I've used VB 4.0 and created
  391.     ' sample dialog with correct names. You can also capture any
  392.     ' tabstrip from any windows dialog you find correct and then
  393.     ' replace text in each tab you want with label control with name
  394.     ' you want to use. (It's good idea to save these images in 16-color
  395.     ' mode for smaller size).
  396.     ' As you can see, left & right side and bottom of tab main frame
  397.     ' are made of 2 shape control each and filled with correct color
  398.     ' to make 3D effect. You can also align these lines in form_load
  399.     ' if you wish.
  400.     ' Well. As you can see I've used control arrays for simpler
  401.     ' operation. The first tabstrip imgTab(0) and it's panel picTab(0)
  402.     ' are placed on final location. When form is loading other tabstrips
  403.     ' and panels are aligned after first.
  404.     ' All four labels are brought to top (zorder). They are label con-
  405.     ' trols with no caption and have BackStyle set to Transparent.
  406.     ' Borders are visible because of better visibility in design mode.
  407.     ' Also if you can, make panels using other controls what can
  408.     ' accept child controls (not picture boxes like in this sample)
  409.     ' like SSPanel fom threed.vbx etc. This saves system resources.
  410.     '
  411.     ' Be happy (always ;)
  412.     '
  413.     ' Ahto
  414.     '
  415.     ' P.S. Please don't angry for blinking text on About tab, this is
  416.     ' my *cry*, because *I don't like injustice*...
  417. End Sub
  418. Sub lblTab_click (Index As Integer)
  419.     ' Check if user clicked tab is already visible
  420.     ' If so don't redraw & exit, else show choosed tab
  421.     If Index <> LastActiveTab Then
  422.     ' show tab user choosed and also panel
  423.     imgTab(Index).Visible = True
  424.     picTab(Index).Visible = True
  425.     ' hide previous tab & panel
  426.     imgTab(LastActiveTab).Visible = False
  427.     picTab(LastActiveTab).Visible = False
  428.     ' Last viewed tab = current tab
  429.     ActiveTab = Index
  430.     ' Last clicked tab = current tab
  431.     LastActiveTab = Index
  432.     End If
  433. End Sub
  434. Sub Timer1_Timer ()
  435.     If lblImportant.Visible Then
  436.     lblImportant.Visible = False
  437.     Else
  438.     lblImportant.Visible = True
  439.     End If
  440. End Sub
  441.