home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmConfig
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Simple Visual Basic tabbed dialog demo"
- ClientHeight = 5925
- ClientLeft = 1860
- ClientTop = 1740
- ClientWidth = 8100
- Height = 6330
- Left = 1800
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5925
- ScaleWidth = 8100
- Top = 1395
- Width = 8220
- Begin PictureBox picTab
- BackColor = &H00C0C0C0&
- Height = 3000
- Index = 2
- Left = 7020
- ScaleHeight = 2970
- ScaleWidth = 5805
- TabIndex = 11
- Top = 1530
- Width = 5835
- Visible = 0 'False
- Begin Frame Frame3
- BackColor = &H00C0C0C0&
- Caption = "Frame3"
- Height = 1095
- Left = 315
- TabIndex = 12
- Top = 1530
- Width = 5250
- End
- Begin Frame Frame2
- BackColor = &H00C0C0C0&
- Caption = "Frame2"
- Height = 1065
- Left = 315
- TabIndex = 13
- Top = 285
- Width = 5235
- Begin OptionButton Option2
- BackColor = &H00C0C0C0&
- Caption = "Option2"
- Height = 330
- Left = 2910
- TabIndex = 15
- Top = 435
- Width = 1920
- End
- Begin OptionButton Option1
- BackColor = &H00C0C0C0&
- Caption = "Option1"
- Height = 360
- Left = 630
- TabIndex = 16
- Top = 435
- Width = 1875
- End
- End
- End
- Begin PictureBox picTab
- BackColor = &H00C0C0C0&
- Height = 3000
- Index = 3
- Left = 1170
- ScaleHeight = 2970
- ScaleWidth = 5805
- TabIndex = 14
- Top = 990
- Width = 5835
- Visible = 0 'False
- Begin Timer Timer1
- Interval = 1000
- Left = 4440
- Top = 1710
- End
- Begin Label Label5
- BackColor = &H00C0C0C0&
- Caption = "January 16, 1996"
- Height = 285
- Left = 3735
- TabIndex = 9
- Top = 720
- Width = 1575
- End
- Begin Label Label4
- BackColor = &H00C0C0C0&
- Caption = "e-mail: ahto.taig@online.ee"
- Height = 270
- Left = 2880
- TabIndex = 10
- Top = 435
- Width = 2430
- End
- Begin Label lblImportant
- BackColor = &H00C0C0C0&
- Caption = "STOP RUSSIAN INVASION IN CHECHNYA!"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 22.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H000000FF&
- Height = 2160
- Left = 465
- TabIndex = 18
- Top = 675
- Width = 3330
- End
- Begin Label Label2
- BackColor = &H00C0C0C0&
- Caption = "this demo by Ahto Tanner, Estonia"
- Height = 300
- Left = 2265
- TabIndex = 17
- Top = 135
- Width = 3060
- End
- End
- Begin PictureBox picTab
- BackColor = &H00C0C0C0&
- Height = 3000
- Index = 1
- Left = 6540
- ScaleHeight = 2970
- ScaleWidth = 5805
- TabIndex = 8
- Top = 420
- Width = 5835
- Visible = 0 'False
- Begin CheckBox Check3
- BackColor = &H00C0C0C0&
- Caption = "Check3"
- Height = 405
- Left = 630
- TabIndex = 24
- Top = 1725
- Width = 2550
- End
- Begin CheckBox Check2
- BackColor = &H00C0C0C0&
- Caption = "Check2"
- Height = 405
- Left = 630
- TabIndex = 23
- Top = 1140
- Width = 2535
- End
- Begin CheckBox Check1
- BackColor = &H00C0C0C0&
- Caption = "Check1"
- Height = 390
- Left = 630
- TabIndex = 22
- Top = 525
- Width = 2490
- End
- Begin CommandButton Command1
- Caption = "Command1"
- Height = 495
- Left = 3645
- TabIndex = 21
- Top = 1980
- Width = 1710
- End
- End
- Begin PictureBox picTab
- BackColor = &H00C0C0C0&
- Height = 3000
- Index = 0
- Left = 255
- ScaleHeight = 2970
- ScaleWidth = 5805
- TabIndex = 7
- Top = 660
- Width = 5835
- Begin Frame Frame1
- BackColor = &H00C0C0C0&
- Caption = "Frame1"
- Height = 2595
- Left = 180
- TabIndex = 19
- Top = 165
- Width = 5385
- Begin Label Label3
- BackColor = &H00C0C0C0&
- Caption = "The explanation of this demo is in Form_Load procedure of this form"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 15
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H0000FFFF&
- Height = 1335
- Left = 390
- TabIndex = 20
- Top = 660
- Width = 4590
- End
- End
- End
- Begin CommandButton butHelp
- Caption = "&Help"
- Height = 405
- Left = 150
- TabIndex = 2
- Top = 3915
- Width = 1200
- End
- Begin CommandButton butCancel
- Cancel = -1 'True
- Caption = "C&ancel"
- Height = 405
- Left = 5025
- TabIndex = 1
- Top = 3915
- Width = 1200
- End
- Begin CommandButton butOK
- Caption = "&OK"
- Default = -1 'True
- Height = 405
- Left = 3780
- TabIndex = 0
- Top = 3915
- Width = 1200
- End
- Begin Line linHor1
- X1 = 150
- X2 = 6210
- Y1 = 3825
- Y2 = 3825
- End
- Begin Line linHor2
- BorderColor = &H00808080&
- BorderWidth = 2
- X1 = 195
- X2 = 6180
- Y1 = 3795
- Y2 = 3810
- End
- Begin Line linVert3
- BorderColor = &H00808080&
- BorderWidth = 2
- X1 = 6195
- X2 = 6195
- Y1 = 645
- Y2 = 3810
- End
- Begin Line linVert2
- BorderColor = &H00FFFFFF&
- BorderWidth = 2
- X1 = 180
- X2 = 180
- Y1 = 585
- Y2 = 3795
- End
- Begin Line linVert4
- X1 = 6210
- X2 = 6210
- Y1 = 645
- Y2 = 3840
- End
- Begin Line linVert1
- X1 = 150
- X2 = 150
- Y1 = 645
- Y2 = 3825
- End
- Begin Label lblTab
- BackColor = &H8000000F&
- BackStyle = 0 'Transparent
- BorderStyle = 1 'Fixed Single
- Height = 360
- Index = 3
- Left = 4740
- TabIndex = 6
- Top = 180
- Width = 1455
- End
- Begin Label lblTab
- BackColor = &H8000000F&
- BackStyle = 0 'Transparent
- BorderStyle = 1 'Fixed Single
- Height = 360
- Index = 2
- Left = 3225
- TabIndex = 5
- Top = 180
- Width = 1455
- End
- Begin Label lblTab
- BackColor = &H8000000F&
- BackStyle = 0 'Transparent
- BorderStyle = 1 'Fixed Single
- Height = 360
- Index = 1
- Left = 1695
- TabIndex = 4
- Top = 195
- Width = 1470
- End
- Begin Label lblTab
- BackColor = &H8000000F&
- BackStyle = 0 'Transparent
- BorderStyle = 1 'Fixed Single
- Height = 360
- Index = 0
- Left = 210
- TabIndex = 3
- Top = 210
- Width = 1410
- End
- Begin Image imgTab
- Height = 480
- Index = 3
- Left = 480
- Picture = VBTABDLG.FRX:0000
- Top = 4980
- Width = 6075
- Visible = 0 'False
- End
- Begin Image imgTab
- Height = 495
- Index = 2
- Left = 300
- Picture = VBTABDLG.FRX:338A
- Top = 4725
- Width = 6075
- Visible = 0 'False
- End
- Begin Image imgTab
- Height = 495
- Index = 1
- Left = 150
- Picture = VBTABDLG.FRX:68AC
- Top = 4500
- Width = 6075
- Visible = 0 'False
- End
- Begin Image imgTab
- Height = 495
- Index = 0
- Left = 150
- Picture = VBTABDLG.FRX:9DCE
- Top = 165
- Width = 6075
- End
- Option Explicit
- Sub butCancel_Click ()
- Unload Me
- End Sub
- Sub butOK_Click ()
- Unload Me
- End Sub
- Sub Form_Load ()
- Dim i As Integer
- ' center form
- Me.Move screen.Width \ 2 - Me.Width \ 2, screen.Height \ 2 - Me.Height \ 2
- LastActiveTab = 0
- ' with each panel 0 to 3 do next
- For i = 0 To 3
- ' move each tab image to the same location as imgTab(0)
- imgTab(i).Move imgTab(0).Left, imgTab(0).Top
- ' move each panel to the same location as picTab(0)
- picTab(i).Move picTab(0).Left, picTab(0).Top
- ' hide borders of tab labels
- lblTab(i).BorderStyle = 0
- ' hide borders of each panel
- picTab(i).BorderStyle = 0
- Next i
- ' show this tab that user viewed last
- ' ActiveTab is declared as global var in BAS file
- Call lblTab_click(ActiveTab)
- ' Hi!
- '
- ' Here is a little example how to create simple tabbed dialog
- ' like ones in Word or Excel and many other Windows programs.
- ' The biggest problem here is to make bitmaps for each tab header
- ' you want to display. This is simple, if you can use any
- ' shareware TabDlg VBXs "in demo mode" to create sample dialog
- ' and then capture it's image. I've used VB 4.0 and created
- ' sample dialog with correct names. You can also capture any
- ' tabstrip from any windows dialog you find correct and then
- ' replace text in each tab you want with label control with name
- ' you want to use. (It's good idea to save these images in 16-color
- ' mode for smaller size).
- ' As you can see, left & right side and bottom of tab main frame
- ' are made of 2 shape control each and filled with correct color
- ' to make 3D effect. You can also align these lines in form_load
- ' if you wish.
- ' Well. As you can see I've used control arrays for simpler
- ' operation. The first tabstrip imgTab(0) and it's panel picTab(0)
- ' are placed on final location. When form is loading other tabstrips
- ' and panels are aligned after first.
- ' All four labels are brought to top (zorder). They are label con-
- ' trols with no caption and have BackStyle set to Transparent.
- ' Borders are visible because of better visibility in design mode.
- ' Also if you can, make panels using other controls what can
- ' accept child controls (not picture boxes like in this sample)
- ' like SSPanel fom threed.vbx etc. This saves system resources.
- '
- ' Be happy (always ;)
- '
- ' Ahto
- '
- ' P.S. Please don't angry for blinking text on About tab, this is
- ' my *cry*, because *I don't like injustice*...
- End Sub
- Sub lblTab_click (Index As Integer)
- ' Check if user clicked tab is already visible
- ' If so don't redraw & exit, else show choosed tab
- If Index <> LastActiveTab Then
- ' show tab user choosed and also panel
- imgTab(Index).Visible = True
- picTab(Index).Visible = True
- ' hide previous tab & panel
- imgTab(LastActiveTab).Visible = False
- picTab(LastActiveTab).Visible = False
- ' Last viewed tab = current tab
- ActiveTab = Index
- ' Last clicked tab = current tab
- LastActiveTab = Index
- End If
- End Sub
- Sub Timer1_Timer ()
- If lblImportant.Visible Then
- lblImportant.Visible = False
- Else
- lblImportant.Visible = True
- End If
- End Sub
-