home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Bubble-Gra77974512002.psc / frmSettings.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-04-19  |  16.4 KB  |  518 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmSettings 
  4.    AutoRedraw      =   -1  'True
  5.    BackColor       =   &H00000000&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "Bubble-Gravity
  8.  by SOM"
  9.    ClientHeight    =   4110
  10.    ClientLeft      =   45
  11.    ClientTop       =   330
  12.    ClientWidth     =   5970
  13.    ForeColor       =   &H00404040&
  14.    Icon            =   "frmSettings.frx":0000
  15.    LinkTopic       =   "Form1"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   274
  19.    ScaleMode       =   3  'Pixel
  20.    ScaleWidth      =   398
  21.    StartUpPosition =   3  'Windows Default
  22.    Begin MSComDlg.CommonDialog cdlg 
  23.       Left            =   5520
  24.       Top             =   2400
  25.       _ExtentX        =   847
  26.       _ExtentY        =   847
  27.       _Version        =   393216
  28.    End
  29.    Begin VB.Frame fraColours 
  30.       BackColor       =   &H00000000&
  31.       Caption         =   "Colours"
  32.       BeginProperty Font 
  33.          Name            =   "MS Sans Serif"
  34.          Size            =   8.25
  35.          Charset         =   0
  36.          Weight          =   700
  37.          Underline       =   0   'False
  38.          Italic          =   0   'False
  39.          Strikethrough   =   0   'False
  40.       EndProperty
  41.       ForeColor       =   &H00BBEBFD&
  42.       Height          =   1695
  43.       Left            =   3720
  44.       TabIndex        =   20
  45.       Top             =   2160
  46.       Width           =   2055
  47.       Begin VB.Label lblColour 
  48.          BackStyle       =   0  'Transparent
  49.          Caption         =   "Bubble Colour2"
  50.          BeginProperty Font 
  51.             Name            =   "Arial"
  52.             Size            =   9.75
  53.             Charset         =   0
  54.             Weight          =   700
  55.             Underline       =   0   'False
  56.             Italic          =   0   'False
  57.             Strikethrough   =   0   'False
  58.          EndProperty
  59.          ForeColor       =   &H00FF0000&
  60.          Height          =   255
  61.          Index           =   2
  62.          Left            =   120
  63.          TabIndex        =   23
  64.          Top             =   1320
  65.          Width           =   1700
  66.       End
  67.       Begin VB.Label lblColour 
  68.          BackStyle       =   0  'Transparent
  69.          Caption         =   "Bubble Colour1"
  70.          BeginProperty Font 
  71.             Name            =   "Arial"
  72.             Size            =   9.75
  73.             Charset         =   0
  74.             Weight          =   700
  75.             Underline       =   0   'False
  76.             Italic          =   0   'False
  77.             Strikethrough   =   0   'False
  78.          EndProperty
  79.          ForeColor       =   &H00808000&
  80.          Height          =   255
  81.          Index           =   1
  82.          Left            =   120
  83.          TabIndex        =   22
  84.          Top             =   840
  85.          Width           =   1575
  86.       End
  87.       Begin VB.Label lblColour 
  88.          BackStyle       =   0  'Transparent
  89.          Caption         =   "Selected Bubble"
  90.          BeginProperty Font 
  91.             Name            =   "Arial"
  92.             Size            =   9.75
  93.             Charset         =   0
  94.             Weight          =   700
  95.             Underline       =   0   'False
  96.             Italic          =   0   'False
  97.             Strikethrough   =   0   'False
  98.          EndProperty
  99.          ForeColor       =   &H00FF0000&
  100.          Height          =   255
  101.          Index           =   0
  102.          Left            =   120
  103.          TabIndex        =   21
  104.          Top             =   360
  105.          Width           =   1575
  106.       End
  107.    End
  108.    Begin VB.TextBox txtGameSpeed 
  109.       Height          =   285
  110.       Left            =   1560
  111.       TabIndex        =   17
  112.       Text            =   "0"
  113.       Top             =   2520
  114.       Width           =   615
  115.    End
  116.    Begin VB.Frame Frame1 
  117.       BackColor       =   &H00000000&
  118.       Height          =   975
  119.       Left            =   3720
  120.       TabIndex        =   13
  121.       Top             =   960
  122.       Width           =   2055
  123.       Begin VB.CheckBox chkChGrav 
  124.          BackColor       =   &H00000000&
  125.          Caption         =   "Change Gravity"
  126.          ForeColor       =   &H00E2F4FC&
  127.          Height          =   255
  128.          Left            =   90
  129.          TabIndex        =   15
  130.          Top             =   240
  131.          Width           =   1800
  132.       End
  133.       Begin VB.CheckBox chkChWind 
  134.          BackColor       =   &H00000000&
  135.          Caption         =   "Change Wind"
  136.          ForeColor       =   &H00E2F4FC&
  137.          Height          =   255
  138.          Left            =   90
  139.          TabIndex        =   14
  140.          Top             =   600
  141.          Value           =   1  'Checked
  142.          Width           =   1800
  143.       End
  144.    End
  145.    Begin VB.TextBox txtChangeTime 
  146.       Height          =   285
  147.       Left            =   4320
  148.       TabIndex        =   9
  149.       Text            =   "0"
  150.       Top             =   600
  151.       Width           =   615
  152.    End
  153.    Begin VB.TextBox txtResetTime 
  154.       Height          =   285
  155.       Left            =   1560
  156.       TabIndex        =   6
  157.       Text            =   "0"
  158.       Top             =   1995
  159.       Width           =   615
  160.    End
  161.    Begin VB.HScrollBar hsbBubbleSize 
  162.       Height          =   255
  163.       LargeChange     =   10
  164.       Left            =   120
  165.       TabIndex        =   3
  166.       Top             =   1320
  167.       Width           =   2895
  168.    End
  169.    Begin VB.HScrollBar hsbBubbles 
  170.       Height          =   255
  171.       LargeChange     =   20
  172.       Left            =   120
  173.       TabIndex        =   1
  174.       Top             =   600
  175.       Width           =   2895
  176.    End
  177.    Begin VB.CommandButton cmdApply 
  178.       Caption         =   "&Apply"
  179.       Default         =   -1  'True
  180.       Height          =   375
  181.       Left            =   1200
  182.       TabIndex        =   16
  183.       Top             =   3600
  184.       Width           =   1095
  185.    End
  186.    Begin VB.CommandButton cmdOK 
  187.       Caption         =   "&OK"
  188.       Height          =   375
  189.       Left            =   120
  190.       TabIndex        =   11
  191.       Top             =   3600
  192.       Width           =   1095
  193.    End
  194.    Begin VB.Label lblDesc 
  195.       BackStyle       =   0  'Transparent
  196.       Caption         =   "Simulate every"
  197.       BeginProperty Font 
  198.          Name            =   "Arial"
  199.          Size            =   9.75
  200.          Charset         =   0
  201.          Weight          =   700
  202.          Underline       =   0   'False
  203.          Italic          =   0   'False
  204.          Strikethrough   =   0   'False
  205.       EndProperty
  206.       ForeColor       =   &H00BBEBFD&
  207.       Height          =   255
  208.       Index           =   8
  209.       Left            =   120
  210.       TabIndex        =   19
  211.       Top             =   2565
  212.       Width           =   1455
  213.    End
  214.    Begin VB.Label lblDesc 
  215.       BackStyle       =   0  'Transparent
  216.       Caption         =   "milliseconds"
  217.       BeginProperty Font 
  218.          Name            =   "Arial"
  219.          Size            =   9.75
  220.          Charset         =   0
  221.          Weight          =   700
  222.          Underline       =   0   'False
  223.          Italic          =   0   'False
  224.          Strikethrough   =   0   'False
  225.       EndProperty
  226.       ForeColor       =   &H00BBEBFD&
  227.       Height          =   255
  228.       Index           =   7
  229.       Left            =   2280
  230.       TabIndex        =   18
  231.       Top             =   2565
  232.       Width           =   1215
  233.    End
  234.    Begin VB.Label lblDesc 
  235.       Alignment       =   2  'Center
  236.       BackStyle       =   0  'Transparent
  237.       Caption         =   "<<-- Lighter Heavier->>"
  238.       BeginProperty Font 
  239.          Name            =   "Arial"
  240.          Size            =   9.75
  241.          Charset         =   0
  242.          Weight          =   700
  243.          Underline       =   0   'False
  244.          Italic          =   0   'False
  245.          Strikethrough   =   0   'False
  246.       EndProperty
  247.       ForeColor       =   &H00BBEBFD&
  248.       Height          =   255
  249.       Index           =   6
  250.       Left            =   360
  251.       TabIndex        =   12
  252.       Top             =   1590
  253.       Width           =   2415
  254.    End
  255.    Begin VB.Label lblDesc 
  256.       BackStyle       =   0  'Transparent
  257.       Caption         =   "seconds"
  258.       BeginProperty Font 
  259.          Name            =   "Arial"
  260.          Size            =   9.75
  261.          Charset         =   0
  262.          Weight          =   700
  263.          Underline       =   0   'False
  264.          Italic          =   0   'False
  265.          Strikethrough   =   0   'False
  266.       EndProperty
  267.       ForeColor       =   &H00BBEBFD&
  268.       Height          =   255
  269.       Index           =   5
  270.       Left            =   5040
  271.       TabIndex        =   10
  272.       Top             =   600
  273.       Width           =   855
  274.    End
  275.    Begin VB.Label lblDesc 
  276.       BackStyle       =   0  'Transparent
  277.       Caption         =   "Change Gravity/Wind every"
  278.       BeginProperty Font 
  279.          Name            =   "Arial"
  280.          Size            =   9.75
  281.          Charset         =   0
  282.          Weight          =   700
  283.          Underline       =   0   'False
  284.          Italic          =   0   'False
  285.          Strikethrough   =   0   'False
  286.       EndProperty
  287.       ForeColor       =   &H00BBEBFD&
  288.       Height          =   495
  289.       Index           =   4
  290.       Left            =   3720
  291.       TabIndex        =   8
  292.       Top             =   360
  293.       Width           =   2055
  294.    End
  295.    Begin VB.Label lblDesc 
  296.       BackStyle       =   0  'Transparent
  297.       Caption         =   "seconds"
  298.       BeginProperty Font 
  299.          Name            =   "Arial"
  300.          Size            =   9.75
  301.          Charset         =   0
  302.          Weight          =   700
  303.          Underline       =   0   'False
  304.          Italic          =   0   'False
  305.          Strikethrough   =   0   'False
  306.       EndProperty
  307.       ForeColor       =   &H00BBEBFD&
  308.       Height          =   255
  309.       Index           =   3
  310.       Left            =   2280
  311.       TabIndex        =   7
  312.       Top             =   2040
  313.       Width           =   975
  314.    End
  315.    Begin VB.Label lblDesc 
  316.       BackStyle       =   0  'Transparent
  317.       Caption         =   "Reset every"
  318.       BeginProperty Font 
  319.          Name            =   "Arial"
  320.          Size            =   9.75
  321.          Charset         =   0
  322.          Weight          =   700
  323.          Underline       =   0   'False
  324.          Italic          =   0   'False
  325.          Strikethrough   =   0   'False
  326.       EndProperty
  327.       ForeColor       =   &H00BBEBFD&
  328.       Height          =   255
  329.       Index           =   2
  330.       Left            =   360
  331.       TabIndex        =   5
  332.       Top             =   2040
  333.       Width           =   1335
  334.    End
  335.    Begin VB.Label lblDesc 
  336.       BackStyle       =   0  'Transparent
  337.       Caption         =   "Average Bubble Mass"
  338.       BeginProperty Font 
  339.          Name            =   "Arial"
  340.          Size            =   9.75
  341.          Charset         =   0
  342.          Weight          =   700
  343.          Underline       =   0   'False
  344.          Italic          =   0   'False
  345.          Strikethrough   =   0   'False
  346.       EndProperty
  347.       ForeColor       =   &H00BBEBFD&
  348.       Height          =   255
  349.       Index           =   1
  350.       Left            =   120
  351.       TabIndex        =   4
  352.       Top             =   1080
  353.       Width           =   2175
  354.    End
  355.    Begin VB.Label lblBubbles 
  356.       BackStyle       =   0  'Transparent
  357.       Caption         =   "0"
  358.       BeginProperty Font 
  359.          Name            =   "MS Sans Serif"
  360.          Size            =   8.25
  361.          Charset         =   0
  362.          Weight          =   700
  363.          Underline       =   0   'False
  364.          Italic          =   0   'False
  365.          Strikethrough   =   0   'False
  366.       EndProperty
  367.       ForeColor       =   &H00E2F4FC&
  368.       Height          =   255
  369.       Left            =   3015
  370.       TabIndex        =   2
  371.       Top             =   600
  372.       Width           =   510
  373.    End
  374.    Begin VB.Label lblDesc 
  375.       BackStyle       =   0  'Transparent
  376.       Caption         =   "Number of Bubbles"
  377.       BeginProperty Font 
  378.          Name            =   "Arial"
  379.          Size            =   9.75
  380.          Charset         =   0
  381.          Weight          =   700
  382.          Underline       =   0   'False
  383.          Italic          =   0   'False
  384.          Strikethrough   =   0   'False
  385.       EndProperty
  386.       ForeColor       =   &H00BBEBFD&
  387.       Height          =   255
  388.       Index           =   0
  389.       Left            =   120
  390.       TabIndex        =   0
  391.       Top             =   360
  392.       Width           =   2175
  393.    End
  394. Attribute VB_Name = "frmSettings"
  395. Attribute VB_GlobalNameSpace = False
  396. Attribute VB_Creatable = False
  397. Attribute VB_PredeclaredId = True
  398. Attribute VB_Exposed = False
  399. Option Explicit
  400. Private Sub cmdApply_Click()
  401. Call ChkSave
  402. Call MakeBubbles
  403. End Sub
  404. Private Sub cmdOK_Click()
  405. Dim IsSaved As Boolean
  406. Call ChkSave(IsSaved)
  407. If IsSaved Then
  408.     Unload Me
  409. End If
  410. End Sub
  411. Private Sub Form_Activate()
  412. Dim i As Integer
  413. Call MakeBubbles
  414. For i = 0 To UBound(SetColours)
  415.     Call ShowColours(i)
  416. Next i
  417. End Sub
  418. Private Sub Form_Load()
  419. Dim TempText As String
  420. 'Shows all the settings
  421. With hsbBubbles
  422.     .Max = MaxBubbles
  423.     .Value = BubbleCount
  424. End With
  425. With hsbBubbleSize
  426.     .Max = MassLimit
  427.     .Min = MassMin
  428.     .Value = MaxMass
  429. End With
  430. With txtChangeTime
  431.     .Text = ChangeTime
  432. '    TempText = "Sets how often the Auto-Screensaver will change the gravity/wind speed."
  433. '    .ToolTipText = TempText
  434. End With
  435. With txtResetTime
  436.     .Text = ResetTime
  437. '    TempText = "Sets how often the Auto-Screensaver will reset." & Chr(13) & "On each reset, all the bubbles will be popped, and gravity and wind set back to 0. The Auto-Screensaver will generate the bubbles again."
  438. '    .ToolTipText = TempText
  439. End With
  440. With txtGameSpeed
  441.     .Text = GameSpeed
  442. '    .ToolTipText = "Sets the speed of the simulation. The lower the setting, the faster it will run." & Chr(13) & Chr(10) & "In non-Windows NT systems, setting this to lower than 30 will have no effect."
  443. End With
  444. chkChGrav.Value = Abs(ChGrav)
  445. chkChWind.Value = Abs(ChWind)
  446. End Sub
  447. Private Sub hsbBubbles_Change()
  448. lblBubbles.Caption = hsbBubbles.Value + 1
  449. End Sub
  450. Sub MakeBubbles()
  451. 'This shows random bubbles in the settings form according to give
  452. 'a preview of bubble density and mass
  453. Dim i As Integer
  454. Dim ThisColour As Long
  455. Dim NumBubbles As Integer
  456. 'Displays approx the same *density* of bubbles on the settings form
  457. NumBubbles = Round(BubbleCount * ((Me.Width + Me.Height) / 2) / ((Screen.Width + Screen.Height) / 2))
  458. Me.Cls
  459. For i = 0 To NumBubbles
  460.     DoEvents
  461.     If i / 20 = Int(i / 20) Then
  462.         Randomize
  463.     End If
  464. '    If SomRand(1, 0, , True) = 1 Then
  465. '        ThisColour = vbBlue
  466. '    Else
  467. '        ThisColour = vbGreen
  468. '    End If
  469.     ThisColour = SetColours(SomRand(2, 1))
  470.     Me.Circle (SomRand(Me.ScaleWidth, 0, , True), SomRand(Me.ScaleHeight, 0, , True)), SomRand(MaxMass, MassMin, , True) / 4, ThisColour
  471. Next i
  472. End Sub
  473. Sub ChkSave(Optional ByRef Saved As Boolean)
  474. If IsNumeric(txtResetTime.Text) And IsNumeric(txtChangeTime.Text) And IsNumeric(txtGameSpeed.Text) Then
  475.     If txtResetTime.Text > 0 And txtChangeTime.Text > 0 And txtGameSpeed.Text > 0 Then
  476.         Call SaveSettings
  477.         Saved = True
  478.     Else
  479.         MsgBox "Enter a number more than 0", vbInformation
  480.     End If
  481.     MsgBox "Please enter valid settings", vbInformation
  482. End If
  483. End Sub
  484. Sub SaveSettings()
  485. 'Saves the settings
  486. Dim Free As Byte
  487. Dim i As Byte
  488. BubbleCount = hsbBubbles.Value
  489. ChangeTime = txtChangeTime.Text
  490. ResetTime = txtResetTime.Text
  491. MaxMass = hsbBubbleSize.Value
  492. ChGrav = chkChGrav.Value
  493. ChWind = chkChWind.Value
  494. GameSpeed = txtGameSpeed.Text
  495. Free = FreeFile
  496. Open App.Path & "/" & SetName For Output As Free
  497. Print #Free, BubbleCount
  498. Print #Free, ChangeTime
  499. Print #Free, ResetTime
  500. Print #Free, MaxMass
  501. Print #Free, Int(ChGrav)
  502. Print #Free, Int(ChWind)
  503. Print #Free, GameSpeed
  504. For i = 0 To UBound(SetColours)
  505.     Print #Free, SetColours(i)
  506. Next i
  507. Close Free
  508. End Sub
  509. Sub ShowColours(Index As Integer)
  510. lblColour(Index).ForeColor = SetColours(Index)
  511. End Sub
  512. Private Sub lblColour_Click(Index As Integer)
  513. cdlg.Color = SetColours(Index)
  514. cdlg.ShowColor
  515. SetColours(Index) = cdlg.Color
  516. Call ShowColours(Index)
  517. End Sub
  518.