frmSplash.vb

 Public Class frmSplash
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    Friend WithEvents PicBx1 As System.Windows.Forms.PictureBox
    Friend WithEvents PicBx2 As System.Windows.Forms.PictureBox
    Friend WithEvents lblGoOn As System.Windows.Forms.Label
    Friend WithEvents lblSkip As System.Windows.Forms.Label
    Friend WithEvents Timer1 As System.Windows.Forms.Timer
    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents lblWhat As System.Windows.Forms.Label
    Friend WithEvents txtWhat As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmSplash))
        Me.PicBx1 = New System.Windows.Forms.PictureBox
        Me.PicBx2 = New System.Windows.Forms.PictureBox
        Me.lblGoOn = New System.Windows.Forms.Label
        Me.lblSkip = New System.Windows.Forms.Label
        Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
        Me.txtWhat = New System.Windows.Forms.TextBox
        Me.lblWhat = New System.Windows.Forms.Label
        Me.SuspendLayout()
        '
        'PicBx1
        '
        Me.PicBx1.BackColor = System.Drawing.Color.White
        Me.PicBx1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.PicBx1.Image = CType(resources.GetObject("PicBx1.Image"), System.Drawing.Image)
        Me.PicBx1.Location = New System.Drawing.Point(0, 0)
        Me.PicBx1.Name = "PicBx1"
        Me.PicBx1.Size = New System.Drawing.Size(292, 273)
        Me.PicBx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage
        Me.PicBx1.TabIndex = 0
        Me.PicBx1.TabStop = False
        '
        'PicBx2
        '
        Me.PicBx2.BackColor = System.Drawing.Color.Transparent
        Me.PicBx2.Image = CType(resources.GetObject("PicBx2.Image"), System.Drawing.Image)
        Me.PicBx2.Location = New System.Drawing.Point(240, 240)
        Me.PicBx2.Name = "PicBx2"
        Me.PicBx2.Size = New System.Drawing.Size(52, 32)
        Me.PicBx2.TabIndex = 1
        Me.PicBx2.TabStop = False
        Me.PicBx2.Visible = False
        '
        'lblGoOn
        '
        Me.lblGoOn.AutoSize = True
        Me.lblGoOn.BackColor = System.Drawing.Color.White
        Me.lblGoOn.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblGoOn.Cursor = System.Windows.Forms.Cursors.Hand
        Me.lblGoOn.ForeColor = System.Drawing.Color.Blue
        Me.lblGoOn.Location = New System.Drawing.Point(96, 36)
        Me.lblGoOn.Name = "lblGoOn"
        Me.lblGoOn.Size = New System.Drawing.Size(53, 19)
        Me.lblGoOn.TabIndex = 2
        Me.lblGoOn.Text = "Go on >>"
        Me.lblGoOn.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.lblGoOn.Visible = False
        '
        'lblSkip
        '
        Me.lblSkip.AutoSize = True
        Me.lblSkip.BackColor = System.Drawing.Color.White
        Me.lblSkip.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblSkip.Cursor = System.Windows.Forms.Cursors.Hand
        Me.lblSkip.ForeColor = System.Drawing.Color.Blue
        Me.lblSkip.Location = New System.Drawing.Point(8, 36)
        Me.lblSkip.Name = "lblSkip"
        Me.lblSkip.Size = New System.Drawing.Size(39, 19)
        Me.lblSkip.TabIndex = 3
        Me.lblSkip.Text = "Skip X"
        Me.lblSkip.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.lblSkip.Visible = False
        '
        'Timer1
        '
        Me.Timer1.Interval = 2000
        '
        'ImageList1
        '
        Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit
        Me.ImageList1.ImageSize = New System.Drawing.Size(256, 256)
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        '
        'txtWhat
        '
        Me.txtWhat.AutoSize = False
        Me.txtWhat.BackColor = System.Drawing.Color.Black
        Me.txtWhat.ForeColor = System.Drawing.Color.White
        Me.txtWhat.Location = New System.Drawing.Point(0, 128)
        Me.txtWhat.Multiline = True
        Me.txtWhat.Name = "txtWhat"
        Me.txtWhat.ReadOnly = True
        Me.txtWhat.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtWhat.Size = New System.Drawing.Size(144, 144)
        Me.txtWhat.TabIndex = 4
        Me.txtWhat.Text = ""
        Me.txtWhat.Visible = False
        '
        'lblWhat
        '
        Me.lblWhat.AutoSize = True
        Me.lblWhat.BackColor = System.Drawing.Color.White
        Me.lblWhat.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblWhat.Cursor = System.Windows.Forms.Cursors.Hand
        Me.lblWhat.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(178, Byte))
        Me.lblWhat.ForeColor = System.Drawing.Color.Blue
        Me.lblWhat.Location = New System.Drawing.Point(48, 36)
        Me.lblWhat.Name = "lblWhat"
        Me.lblWhat.Size = New System.Drawing.Size(48, 19)
        Me.lblWhat.TabIndex = 5
        Me.lblWhat.Text = "What??!"
        Me.lblWhat.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.lblWhat.Visible = False
        '
        'frmSplash
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.Black
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.Add(Me.lblWhat)
        Me.Controls.Add(Me.txtWhat)
        Me.Controls.Add(Me.lblSkip)
        Me.Controls.Add(Me.lblGoOn)
        Me.Controls.Add(Me.PicBx2)
        Me.Controls.Add(Me.PicBx1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        Me.Name = "frmSplash"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "frmSplash"
        Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private FirstRun As Boolean = False ' Starts the tutorial if its the first run
    Public ShowForm As Integer  ' Determines which tutorial form should be displayed
    Public Comment As String 'ArrayList = New ArrayList
    Public i As Integer = -1

    Private Sub PicBx1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PicBx1.Paint
        Dim GrObj As Graphics = e.Graphics
        GrObj.DrawImage(PicBx2.Image, Screen.PrimaryScreen.Bounds.Size.Width - 400, Screen.PrimaryScreen.Bounds.Size.Height - 23, 400, 28)
        Select Case ShowForm
            Case 1 : GrObj.DrawImage(ImageList1.Images(0), Screen.PrimaryScreen.Bounds.Width \ 2 - 130, Screen.PrimaryScreen.Bounds.Height \ 2 - 130)
            Case 2 : GrObj.DrawImage(ImageList1.Images(1), Screen.PrimaryScreen.Bounds.Width \ 2 - 130, Screen.PrimaryScreen.Bounds.Height \ 2 - 130)
            Case 3 : GrObj.DrawImage(ImageList1.Images(2), Screen.PrimaryScreen.Bounds.Width \ 2 - 130, Screen.PrimaryScreen.Bounds.Height \ 2 - 130)
        End Select
    End Sub

    Private Sub lblGoOn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblGoOn.Click
        lblGoOn.Enabled = False
        Timer1.Enabled = True
    End Sub

    Private Sub lblSkip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSkip.Click
        On Error GoTo Handler
        Timer1.Enabled = False
        With Check.Characters("check")
            .Stop()
            .MoveTo(0, Screen.PrimaryScreen.Bounds.Size.Height - 200)
            MainForm.Show()
            Me.Hide()
        End With
Handler:
        If Err.Number <> 0 Then
            Timer1.Enabled = False
            ErrMsg(Err.Source.ToString)
        End If
    End Sub

    Private Sub frmSplash_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
        On Error GoTo Handler
        Check.Characters("check").Activate()
Handler:
        If Err.Number <> 0 Then
            Timer1.Enabled = False
            ErrMsg(Err.Source.ToString)
        End If
    End Sub

    Private Sub frmSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        On Error GoTo Handler
        splash = Me
        MainForm = New FrmGameSurface
        FirstRun = GetSetting("8Queens solutions", "Run", "FirstRun", 1)
        SaveSetting("8Queens solutions", "Run", "FirstRun", 0)

        Check = New AgentObjects.Agent
        Check.Connected = True
        Check.Characters.Load("Check", "Check.acs")
        Check.Characters("check").AutoPopupMenu = False
        If FirstRun Then
            Timer1.Enabled = True
        Else
            With Check.Characters("check")
                .MoveTo(0, Screen.PrimaryScreen.Bounds.Size.Height - 200)
                .Show()
                .Speak("Greetings!")
            End With
            MainForm.Show()
            Me.Hide()
        End If
Handler:
        If Err.Number <> 0 Then
            Timer1.Enabled = False
            ErrMsg(Err.Source.ToString)
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        On Error GoTo Handler
        Select Case i
            Case 0
                'System.Threading.Thread.Sleep(3000)
                Check.Characters("check").Show()
                Speak("Greetings!")

            Case 1 : Speak("I'm the King.")

            Case 3 : Speak("This is the first use of my Queens, so I'm here to help you!")

            Case 5
                lblGoOn.Left = Screen.PrimaryScreen.Bounds.Size.Width - 80
                lblGoOn.Top = Screen.PrimaryScreen.Bounds.Size.Height - 60
                lblWhat.Left = lblGoOn.Left - lblWhat.Width - 5
                lblWhat.Top = Screen.PrimaryScreen.Bounds.Size.Height - 60
                lblSkip.Left = lblWhat.Left - lblSkip.Width - 5
                lblSkip.Top = Screen.PrimaryScreen.Bounds.Size.Height - 60
                Check.Characters("check").MoveTo(lblWhat.Left - 20, lblWhat.Top - 150)

            Case 6
                lblGoOn.Visible = True
                lblSkip.Visible = True
                lblWhat.Visible = True
                Speak("Click ""GoOn"" to begin the instructions or ""Skip"" to start the problem. Click ""What??!"" for replications.")
                Timer1.Enabled = False

            Case 7
                ShowForm = 1
                PicBx1.Invalidate()
                Check.Characters("check").Stop()
                Check.Characters("check").MoveTo(Me.Width / 2, Me.Height / 2)
                Speak("This is my chess board and those are my Queens!")

            Case 10 : Speak("As you have noticed, this program is to solve my famous problem.")

            Case 13 : Speak("The Eight Queens!")

            Case 15 : Speak("It means that you have to place all Queens on the board without any conflictions.")

            Case 19
                Speak("Any Queen being put on the board would disable some points.")
                Check.Characters("check").MoveTo(Me.Width / 2 + 100, Me.Height / 2)

            Case 22
                Speak("For example:")
                ShowForm = 2
                PicBx1.Invalidate()

            Case 23
                Speak("Click ""GoOn"" to continue or ""Skip"" to start the problem.")
                Timer1.Enabled = False
                lblGoOn.Enabled = True

            Case 24 : Speak("You can not put any more Queens on marked points.")

            Case 27 : Speak("The new Queen may have conflicts with the recent ""X"" signs if she is not directly hitting other Queens.")

            Case 32 : Speak("It means:")

            Case 33
                ShowForm = 3
                PicBx1.Invalidate()
            Case 36
                Speak("In effect you will not see those Xes in the gameplay.")
            Case 39
                Speak("If you succeed placing all Queens without confliction...")
            Case 42
                Speak("You will WIN!")
            Case 45
                Speak("Remember!")
            Case 46
                Speak("The main idea of 8Queens is to introduce you this problem and show you the answers visually.")
            Case 50
                Speak("So beside the game you will be able to cycle through all answers!")
            Case 55
                Speak("Enjoy!")
            Case 56
                Check.Characters("check").MoveTo(lblWhat.Left - 20, lblWhat.Top - 150)
                lblSkip.Text = "Finish"
        End Select
        i += 1
Handler:
        If Err.Number <> 0 Then
            Timer1.Enabled = False
            ErrMsg(Err.Source.ToString)
        End If
    End Sub

    Private Sub lblWhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblWhat.Click
        txtWhat.Top = Me.Height - 160
        txtWhat.Left += 20
        txtWhat.Visible = True
        lblWhat.Enabled = False
    End Sub
    Private Sub Speak(ByVal text As String)
        Comment = text
        Check.Characters("check").Speak(Comment)
        txtWhat.Text = txtWhat.Text.Insert(0, "->" & Comment & vbCrLf & vbCrLf)
    End Sub
End Class

Project Homepage: