home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / begin.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  13.0 KB  |  368 lines

  1. VERSION 4.00
  2. Begin VB.Form frmBegin 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "#"
  5.    ClientHeight    =   3540
  6.    ClientLeft      =   1740
  7.    ClientTop       =   1410
  8.    ClientWidth     =   7545
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   8.25
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    Height          =   3945
  19.    Icon            =   "BEGIN.frx":0000
  20.    Left            =   1680
  21.    LinkMode        =   1  'Source
  22.    LinkTopic       =   "Form1"
  23.    MaxButton       =   0   'False
  24.    MinButton       =   0   'False
  25.    ScaleHeight     =   3540
  26.    ScaleWidth      =   7545
  27.    Top             =   1065
  28.    Width           =   7665
  29.    Begin VB.PictureBox picInstallContainer 
  30.       AutoRedraw      =   -1  'True
  31.       BorderStyle     =   0  'None
  32.       Height          =   1080
  33.       Left            =   330
  34.       ScaleHeight     =   72
  35.       ScaleMode       =   3  'Pixel
  36.       ScaleWidth      =   78
  37.       TabIndex        =   7
  38.       Top             =   510
  39.       Width           =   1170
  40.       Begin VB.PictureBox picInstall 
  41.          AutoSize        =   -1  'True
  42.          BorderStyle     =   0  'None
  43.          Height          =   900
  44.          Left            =   75
  45.          Picture         =   "BEGIN.frx":0442
  46.          ScaleHeight     =   60
  47.          ScaleMode       =   3  'Pixel
  48.          ScaleWidth      =   64
  49.          TabIndex        =   0
  50.          Top             =   75
  51.          Width           =   960
  52.       End
  53.    End
  54.    Begin VB.Frame fraDir 
  55.       Caption         =   "#"
  56.       BeginProperty Font 
  57.          name            =   "MS Sans Serif"
  58.          charset         =   0
  59.          weight          =   400
  60.          size            =   8.25
  61.          underline       =   0   'False
  62.          italic          =   0   'False
  63.          strikethrough   =   0   'False
  64.       EndProperty
  65.       Height          =   660
  66.       Left            =   135
  67.       TabIndex        =   5
  68.       Top             =   2010
  69.       Width           =   7296
  70.       Begin VB.CommandButton cmdChDir 
  71.          Caption         =   "#"
  72.          BeginProperty Font 
  73.             name            =   "MS Sans Serif"
  74.             charset         =   0
  75.             weight          =   400
  76.             size            =   8.25
  77.             underline       =   0   'False
  78.             italic          =   0   'False
  79.             strikethrough   =   0   'False
  80.          EndProperty
  81.          Height          =   390
  82.          Left            =   4905
  83.          TabIndex        =   1
  84.          Top             =   195
  85.          Width           =   2310
  86.       End
  87.       Begin VB.Label lblDestDir 
  88.          Caption         =   "#"
  89.          BeginProperty Font 
  90.             name            =   "MS Sans Serif"
  91.             charset         =   0
  92.             weight          =   400
  93.             size            =   8.25
  94.             underline       =   0   'False
  95.             italic          =   0   'False
  96.             strikethrough   =   0   'False
  97.          EndProperty
  98.          Height          =   240
  99.          Left            =   135
  100.          TabIndex        =   6
  101.          Top             =   300
  102.          Width           =   4440
  103.       End
  104.    End
  105.    Begin VB.CommandButton cmdExit 
  106.       Caption         =   "#"
  107.       BeginProperty Font 
  108.          name            =   "MS Sans Serif"
  109.          charset         =   0
  110.          weight          =   400
  111.          size            =   8.25
  112.          underline       =   0   'False
  113.          italic          =   0   'False
  114.          strikethrough   =   0   'False
  115.       EndProperty
  116.       Height          =   420
  117.       Left            =   2610
  118.       TabIndex        =   2
  119.       Top             =   3030
  120.       Width           =   2205
  121.    End
  122.    Begin VB.Line linTopOfExitButtonIfNoDestDir 
  123.       Visible         =   0   'False
  124.       X1              =   2670
  125.       X2              =   4725
  126.       Y1              =   2280
  127.       Y2              =   2280
  128.    End
  129.    Begin VB.Label lblInstallMsg 
  130.       AutoSize        =   -1  'True
  131.       Caption         =   "*"
  132.       BeginProperty Font 
  133.          name            =   "MS Sans Serif"
  134.          charset         =   0
  135.          weight          =   400
  136.          size            =   8.25
  137.          underline       =   0   'False
  138.          italic          =   0   'False
  139.          strikethrough   =   0   'False
  140.       EndProperty
  141.       Height          =   195
  142.       Left            =   1725
  143.       TabIndex        =   4
  144.       Top             =   915
  145.       Width           =   5565
  146.       WordWrap        =   -1  'True
  147.    End
  148.    Begin VB.Label lblBegin 
  149.       AutoSize        =   -1  'True
  150.       Caption         =   "#"
  151.       BeginProperty Font 
  152.          name            =   "MS Sans Serif"
  153.          charset         =   0
  154.          weight          =   400
  155.          size            =   8.25
  156.          underline       =   0   'False
  157.          italic          =   0   'False
  158.          strikethrough   =   0   'False
  159.       EndProperty
  160.       Height          =   192
  161.       Left            =   288
  162.       TabIndex        =   3
  163.       Top             =   132
  164.       Width           =   6456
  165.       WordWrap        =   -1  'True
  166.    End
  167. Attribute VB_Name = "frmBegin"
  168. Attribute VB_Creatable = False
  169. Attribute VB_Exposed = False
  170. Option Explicit
  171. Option Compare Text
  172. 'Constants/Types for a simulated "picture button"
  173. Const x3DLineWidth = 1 '"Width" of highlight/shadow "lines"
  174. Const y3DLineWidth = x3DLineWidth
  175. Const pbXDeltaMouseDown = x3DLineWidth
  176. Const pbYDeltaMouseDown = y3DLineWidth
  177. Private fMouseDown As Boolean
  178. Private Sub cmdChDir_Click()
  179.     ShowPathDialog gstrDIR_DEST
  180.     If gfRetVal = gintRET_CONT Then
  181.         lblDestDir.Caption = gstrDestDir
  182.         PicButtonSetFocus picInstall, True, True
  183.     End If
  184. End Sub
  185. Private Sub cmdExit_Click()
  186.     ExitSetup Me, gintRET_EXIT
  187. End Sub
  188. Private Sub picInstall_Click()
  189.     If IsValidDestDir() = True Then
  190.         Unload Me
  191.     End If
  192. End Sub
  193. Private Sub Form_Load()
  194.     fraDir.Caption = ResolveResString(resFRMDIRECTORY)
  195.     cmdChDir.Caption = ResolveResString(resBTNCHGDIR)
  196.     cmdExit.Caption = ResolveResString(resBTNEXIT)
  197.     lblBegin.Caption = ResolveResString(resLBLBEGIN)
  198.     Caption = gstrTitle
  199.     lblInstallMsg.Caption = ResolveResString(IIf(gfForceUseDefDest, resSPECNODEST, resSPECDEST), "|1", gstrAppName)
  200.     lblDestDir.Caption = gstrDestDir
  201.     If gfForceUseDefDest Then
  202.         'We are forced to use the default destination directory, so the user
  203.         '  will not be able to change it.
  204.         fraDir.Visible = False
  205.         
  206.         'Close in the blank space on the form by moving the Exit button to where this frame
  207.         'currently is, and adjusting the size of the form respectively
  208.         Dim yAdjust As Integer
  209.         yAdjust = cmdExit.Top - linTopOfExitButtonIfNoDestDir.y1
  210.         cmdExit.Top = cmdExit.Top - yAdjust
  211.         Height = Height - yAdjust
  212.         
  213.         EtchedLine Me, fraDir.Left, cmdExit.Top - cmdExit.Height \ 2, fraDir.Width
  214.     Else
  215.         EtchedLine Me, fraDir.Left, cmdExit.Top - cmdExit.Height \ 2, fraDir.Width
  216.     End If
  217.     PicButtonInit picInstall
  218.     CenterForm Me
  219. End Sub
  220. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  221.     If UnloadMode <> 1 Then
  222.         ExitSetup Me, gintRET_EXIT
  223.         Cancel = 1
  224.     End If
  225. End Sub
  226. Private Sub picInstall_GotFocus()
  227.     PicButtonSetFocus picInstall, True, True
  228. End Sub
  229. Private Sub picInstall_KeyDown(KeyCode As Integer, Shift As Integer)
  230.     If KeyCode = vbKeySpace And Not fPicButtonDown(picInstall) Then
  231.         picInstall.Tag = "1" 'Set flag to indicate that the button is currently "down"
  232.         PicButtonMouseDn picInstall, picInstallContainer
  233.     ElseIf KeyCode = vbKeyEscape And fPicButtonDown(picInstall) Then
  234.         'Cancel button press
  235.         picInstall.Tag = ""
  236.         PicButtonMouseUp picInstall, picInstallContainer
  237.     End If
  238. End Sub
  239. Private Sub picInstall_KeyUp(KeyCode As Integer, Shift As Integer)
  240.     If KeyCode = vbKeySpace And fPicButtonDown(picInstall) Then
  241.         picInstall.Tag = ""
  242.         PicButtonMouseUp picInstall, picInstallContainer
  243.         picInstall_Click
  244.     End If
  245. End Sub
  246. Private Sub picInstall_LostFocus()
  247.     PicButtonSetFocus picInstall, False, True
  248. End Sub
  249. Private Sub picInstall_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  250.     If Not fPicButtonDown(picInstall) Then
  251.         picInstall.Tag = "1"
  252.         fMouseDown = True
  253.         PicButtonMouseDn picInstall, picInstallContainer
  254.     End If
  255. End Sub
  256. Private Sub picInstall_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  257.     If fMouseDown Then
  258.         ' Determine if the mouse has moved onto or off of the button,
  259.         ' and move the button down or up accordingly
  260.         If fPicButtonDown(picInstall) Then
  261.             If Not PtOverControl(picInstall, X + picInstall.Left, Y + picInstall.Top) Then
  262.                 'The mouse has just moved off of the button
  263.                 picInstall.Tag = ""
  264.                 PicButtonMouseUp picInstall, picInstallContainer
  265.             End If
  266.         Else
  267.             If PtOverControl(picInstall, X + picInstall.Left, Y + picInstall.Top) Then
  268.                 'The mouse has just moved over the button
  269.                 picInstall.Tag = "1"
  270.                 PicButtonMouseDn picInstall, picInstallContainer
  271.             End If
  272.         End If
  273.     End If
  274. End Sub
  275. Private Sub picInstall_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  276.     If fPicButtonDown(picInstall) Then
  277.         picInstall.Tag = ""
  278.         PicButtonMouseUp picInstall, picInstallContainer
  279.         fMouseDown = False
  280.     Else
  281.         picInstall.Tag = ""
  282.         fMouseDown = False
  283.     End If
  284. End Sub
  285. Private Sub PicButtonMouseDn(pic As PictureBox, picContainer As PictureBox)
  286.     PicButtonSetFocus pic, True, False
  287.     PicButtonOutline pic, picContainer, pic.Left + 1, pic.Top + 1
  288.     pic.Move pic.Left + 1, pic.Top + 1
  289. End Sub
  290. Private Sub PicButtonMouseUp(pic As PictureBox, picContainer As PictureBox)
  291.     PicButtonOutline pic, picContainer, pic.Left - 1, pic.Top - 1
  292.     pic.Move pic.Left - 1, pic.Top - 1
  293. End Sub
  294. Private Sub PicButtonInit(pic As PictureBox)
  295.     pic.Tag = "" 'Indicates that the button is not currently pressed
  296.     PicButtonSetFocus pic, False, True
  297. End Sub
  298. Private Sub PicButtonOutline(pic As PictureBox, picContainer As PictureBox, ByVal Left As Integer, ByVal Top As Integer)
  299.     Dim x1 As Integer, x2 As Integer, y1 As Integer, y2 As Integer
  300.     With picContainer
  301.         .Cls
  302.         If ActiveControl Is pic Then 'Has focus?
  303.             'Draw a black line around the button
  304.             picContainer.Line (Left - 3, Top - 3)-Step(pic.Width + 2 * 3, pic.Height + 2 * 3), vb3DDKShadow, B
  305.             x1 = Left - 1
  306.             x2 = Left + pic.Width + 1
  307.             y1 = Top - 1
  308.             y2 = Top + pic.Height + 1
  309.         Else
  310.             x1 = Left
  311.             x2 = Left + pic.Width
  312.             y1 = Top
  313.             y2 = Top + pic.Height
  314.         End If
  315.         If fPicButtonDown(pic) Then
  316.             'Draw dark shadows around entire button
  317.             picContainer.Line (x1 - 1, y1 - 1)-(x2 + 1, y2 + 1), vb3DShadow, B
  318.         Else
  319.             'Draw dark shadows on right and bottom outer edges
  320.             picContainer.Line (x1 - 1, y2 + 1)-(x2 + 1, y2 + 1), vb3DDKShadow
  321.             picContainer.Line (x2 + 1, y2 + 1)-(x2 + 1, y1 - 1), vb3DDKShadow
  322.             
  323.             'Draw medium shadows on right and bottom inner edges
  324.             picContainer.Line (x1, y2)-(x2, y2), vb3DShadow
  325.             picContainer.Line (x2, y2)-(x2, y1), vb3DShadow
  326.             
  327.             'Draw highlights on left and top outer edges
  328.             picContainer.Line (x1 - 1, y2 + 1)-(x1 - 1, y1 - 1), vb3DHighlight
  329.             picContainer.Line (x1 - 1, y1 - 1)-(x2 + 1, y1 - 1), vb3DHighlight
  330.         End If
  331.     End With
  332. End Sub
  333. Private Sub PicButtonSetFocus(pic As PictureBox, ByVal fFocus As Boolean, ByVal fRedraw As Boolean)
  334.     If fFocus Then
  335.         pic.SetFocus
  336.     End If
  337.     If fRedraw Then
  338.         PicButtonOutline pic, picInstallContainer, pic.Left, pic.Top
  339.     End If
  340.     If fFocus Then
  341.         Dim c As Control
  342.         
  343.         For Each c In Controls
  344.             If TypeOf c Is CommandButton Then
  345.                 c.Default = False
  346.             End If
  347.         Next c
  348.     End If
  349. End Sub
  350. Private Function PtOverControl(c As Control, ByVal X As Integer, ByVal Y As Integer) As Boolean
  351.     If _
  352.       X >= c.Left _
  353.       And X < c.Left + c.Width _
  354.       And Y >= c.Top _
  355.       And Y < c.Top + c.Height _
  356.     Then
  357.         PtOverControl = True
  358.     Else
  359.         PtOverControl = False
  360.     End If
  361. End Function
  362. Private Function fPicButtonDown(pic As PictureBox)
  363.     fPicButtonDown = (pic.Tag <> "")
  364. End Function
  365. Private Sub picInstallContainer_GotFocus()
  366.     picInstall.SetFocus
  367. End Sub
  368.