Go to Home Page

 

View Output

 

'MSSE Fairfield University

'SW403- Fall 2005

'Guillermo V. Julca

'http://www.gjp2s.com

 

Imports System.IO

Public Class frmMain

    Inherits System.Windows.Forms.Form

    Dim BoardWidth As Integer

    Dim BoardHeight As Integer

    Dim XLocation As Integer

    Dim YLocation As Integer

    Public lstComputerCards As New ImageList

    Public lstGreekCards As New ImageList

 

#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 btnNewGreek As System.Windows.Forms.ToolBarButton

    Friend WithEvents mnuGameMenu As System.Windows.Forms.MainMenu

    Friend WithEvents mnuFile As System.Windows.Forms.MenuItem

    Friend WithEvents mnuFile_New As System.Windows.Forms.MenuItem

    Friend WithEvents mnuFile_NewGreekCardsGame As System.Windows.Forms.MenuItem

    Friend WithEvents mnuFile_NewComputerCardsGame As System.Windows.Forms.MenuItem

    Friend WithEvents mnuFile_Exit As System.Windows.Forms.MenuItem

    Friend WithEvents tbrGameMenu As System.Windows.Forms.ToolBar

    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem

    Friend WithEvents lstGameToolBar As System.Windows.Forms.ImageList

    Friend WithEvents btnNewComputerGame As System.Windows.Forms.ToolBarButton

    Friend WithEvents separator As System.Windows.Forms.ToolBarButton

    Friend WithEvents btnExit As System.Windows.Forms.ToolBarButton

    Friend WithEvents separator1 As System.Windows.Forms.ToolBarButton

    Friend WithEvents pbrInitialize As System.Windows.Forms.ProgressBar

    Friend WithEvents lblInitialize As System.Windows.Forms.Label

    Friend WithEvents btnSave As System.Windows.Forms.ToolBarButton

    Friend WithEvents separator2 As System.Windows.Forms.ToolBarButton

    Friend WithEvents mnuHelp As System.Windows.Forms.MenuItem

    Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem

    Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem

    Friend WithEvents mnuFile_Save As System.Windows.Forms.MenuItem

    Friend WithEvents mnuView As System.Windows.Forms.MenuItem

    Friend WithEvents mnuHelp_Text As System.Windows.Forms.MenuItem

    Friend WithEvents mnuHelp_About As System.Windows.Forms.MenuItem

    Friend WithEvents mnuView_ShowScore As System.Windows.Forms.MenuItem

    Friend WithEvents mnuFile_Close As System.Windows.Forms.MenuItem

    Friend WithEvents btnClose As System.Windows.Forms.ToolBarButton

    Friend WithEvents separator3 As System.Windows.Forms.ToolBarButton

    Friend WithEvents sfdSaveScore As System.Windows.Forms.SaveFileDialog

    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem

    Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem

    Friend WithEvents mnuWebSite As System.Windows.Forms.MenuItem

    Friend WithEvents lblLinkGJWebSite As System.Windows.Forms.LinkLabel

    Friend WithEvents btnHelp As System.Windows.Forms.ToolBarButton

    Friend WithEvents separator4 As System.Windows.Forms.ToolBarButton

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        Me.components = New System.ComponentModel.Container

        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))

        Me.mnuGameMenu = New System.Windows.Forms.MainMenu

        Me.mnuFile = New System.Windows.Forms.MenuItem

        Me.mnuFile_New = New System.Windows.Forms.MenuItem

        Me.mnuFile_NewGreekCardsGame = New System.Windows.Forms.MenuItem

        Me.mnuFile_NewComputerCardsGame = New System.Windows.Forms.MenuItem

        Me.mnuFile_Close = New System.Windows.Forms.MenuItem

        Me.MenuItem3 = New System.Windows.Forms.MenuItem

        Me.mnuFile_Save = New System.Windows.Forms.MenuItem

        Me.MenuItem1 = New System.Windows.Forms.MenuItem

        Me.mnuFile_Exit = New System.Windows.Forms.MenuItem

        Me.mnuView = New System.Windows.Forms.MenuItem

        Me.mnuView_ShowScore = New System.Windows.Forms.MenuItem

        Me.mnuHelp = New System.Windows.Forms.MenuItem

        Me.MenuItem4 = New System.Windows.Forms.MenuItem

        Me.mnuHelp_Text = New System.Windows.Forms.MenuItem

        Me.MenuItem5 = New System.Windows.Forms.MenuItem

        Me.mnuWebSite = New System.Windows.Forms.MenuItem

        Me.MenuItem6 = New System.Windows.Forms.MenuItem

        Me.mnuHelp_About = New System.Windows.Forms.MenuItem

        Me.tbrGameMenu = New System.Windows.Forms.ToolBar

        Me.btnNewGreek = New System.Windows.Forms.ToolBarButton

        Me.separator = New System.Windows.Forms.ToolBarButton

        Me.btnNewComputerGame = New System.Windows.Forms.ToolBarButton

        Me.separator1 = New System.Windows.Forms.ToolBarButton

        Me.btnClose = New System.Windows.Forms.ToolBarButton

        Me.separator3 = New System.Windows.Forms.ToolBarButton

        Me.btnSave = New System.Windows.Forms.ToolBarButton

        Me.separator2 = New System.Windows.Forms.ToolBarButton

        Me.btnHelp = New System.Windows.Forms.ToolBarButton

        Me.separator4 = New System.Windows.Forms.ToolBarButton

        Me.btnExit = New System.Windows.Forms.ToolBarButton

        Me.lstGameToolBar = New System.Windows.Forms.ImageList(Me.components)

        Me.pbrInitialize = New System.Windows.Forms.ProgressBar

        Me.lblInitialize = New System.Windows.Forms.Label

        Me.sfdSaveScore = New System.Windows.Forms.SaveFileDialog

        Me.lblLinkGJWebSite = New System.Windows.Forms.LinkLabel

        Me.SuspendLayout()

        '

        'mnuGameMenu

        '

        Me.mnuGameMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile, Me.mnuView, Me.mnuHelp})

        '

        'mnuFile

        '

        Me.mnuFile.Index = 0

        Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile_New, Me.mnuFile_Close, Me.MenuItem3, Me.mnuFile_Save, Me.MenuItem1, Me.mnuFile_Exit})

        Me.mnuFile.Text = "&File"

        '

        'mnuFile_New

        '

        Me.mnuFile_New.Index = 0

        Me.mnuFile_New.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile_NewGreekCardsGame, Me.mnuFile_NewComputerCardsGame})

        Me.mnuFile_New.Text = "&New"

        '

        'mnuFile_NewGreekCardsGame

        '

        Me.mnuFile_NewGreekCardsGame.Index = 0

        Me.mnuFile_NewGreekCardsGame.Text = "Greek Cards Game"

        '

        'mnuFile_NewComputerCardsGame

        '

        Me.mnuFile_NewComputerCardsGame.Index = 1

        Me.mnuFile_NewComputerCardsGame.Text = "Computer Game Cards"

        '

        'mnuFile_Close

        '

        Me.mnuFile_Close.Index = 1

        Me.mnuFile_Close.Text = "Close"

        '

        'MenuItem3

        '

        Me.MenuItem3.Index = 2

        Me.MenuItem3.Text = "-"

        '

        'mnuFile_Save

        '

        Me.mnuFile_Save.Index = 3

        Me.mnuFile_Save.Text = "Save Score"

        '

        'MenuItem1

        '

        Me.MenuItem1.Index = 4

        Me.MenuItem1.Text = "-"

        '

        'mnuFile_Exit

        '

        Me.mnuFile_Exit.Index = 5

        Me.mnuFile_Exit.Text = "&Exit"

        '

        'mnuView

        '

        Me.mnuView.Index = 1

        Me.mnuView.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuView_ShowScore})

        Me.mnuView.Text = "View"

        '

        'mnuView_ShowScore

        '

        Me.mnuView_ShowScore.Index = 0

        Me.mnuView_ShowScore.Text = "Show Score"

        '

        'mnuHelp

        '

        Me.mnuHelp.Index = 2

        Me.mnuHelp.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem4, Me.mnuHelp_Text, Me.MenuItem5, Me.mnuWebSite, Me.MenuItem6, Me.mnuHelp_About})

        Me.mnuHelp.Text = "Help"

        '

        'MenuItem4

        '

        Me.MenuItem4.Index = 0

        Me.MenuItem4.Text = "-"

        '

        'mnuHelp_Text

        '

        Me.mnuHelp_Text.Index = 1

        Me.mnuHelp_Text.Text = "Contents..."

        '

        'MenuItem5

        '

        Me.MenuItem5.Index = 2

        Me.MenuItem5.Text = "-"

        '

        'mnuWebSite

        '

        Me.mnuWebSite.Index = 3

        Me.mnuWebSite.Text = "GJ WebSite"

        '

        'MenuItem6

        '

        Me.MenuItem6.Index = 4

        Me.MenuItem6.Text = "-"

        '

        'mnuHelp_About

        '

        Me.mnuHelp_About.Index = 5

        Me.mnuHelp_About.Text = "About GJ-Game Memory"

        '

        'tbrGameMenu

        '

        Me.tbrGameMenu.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

        Me.tbrGameMenu.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.btnNewGreek, Me.separator, Me.btnNewComputerGame, Me.separator1, Me.btnClose, Me.separator3, Me.btnSave, Me.separator2, Me.btnHelp, Me.separator4, Me.btnExit})

        Me.tbrGameMenu.ButtonSize = New System.Drawing.Size(32, 32)

        Me.tbrGameMenu.DropDownArrows = True

        Me.tbrGameMenu.ImageList = Me.lstGameToolBar

        Me.tbrGameMenu.Location = New System.Drawing.Point(0, 0)

        Me.tbrGameMenu.Name = "tbrGameMenu"

        Me.tbrGameMenu.ShowToolTips = True

        Me.tbrGameMenu.Size = New System.Drawing.Size(752, 45)

        Me.tbrGameMenu.TabIndex = 0

        '

        'btnNewGreek

        '

        Me.btnNewGreek.ImageIndex = 7

        Me.btnNewGreek.ToolTipText = "New Game (Greek Cards)"

        '

        'separator

        '

        Me.separator.Style = System.Windows.Forms.ToolBarButtonStyle.Separator

        '

        'btnNewComputerGame

        '

        Me.btnNewComputerGame.ImageIndex = 6

        Me.btnNewComputerGame.ToolTipText = "New Game (Computer Cards)"

        '

        'separator1

        '

        Me.separator1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator

        '

        'btnClose

        '

        Me.btnClose.ImageIndex = 8

        Me.btnClose.ToolTipText = "Close Current Game"

        '

        'separator3

        '

        Me.separator3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator

        '

        'btnSave

        '

        Me.btnSave.ImageIndex = 3

        Me.btnSave.ToolTipText = "Save Score Game"

        '

        'separator2

        '

        Me.separator2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator

        '

        'btnHelp

        '

        Me.btnHelp.ImageIndex = 4

        Me.btnHelp.ToolTipText = "Help"

        '

        'separator4

        '

        Me.separator4.Style = System.Windows.Forms.ToolBarButtonStyle.Separator

        '

        'btnExit

        '

        Me.btnExit.ImageIndex = 5

        Me.btnExit.ToolTipText = "Exit"

        '

        'lstGameToolBar

        '

        Me.lstGameToolBar.ImageSize = New System.Drawing.Size(32, 32)

        Me.lstGameToolBar.ImageStream = CType(resources.GetObject("lstGameToolBar.ImageStream"), System.Windows.Forms.ImageListStreamer)

        Me.lstGameToolBar.TransparentColor = System.Drawing.Color.Transparent

        '

        'pbrInitialize

        '

        Me.pbrInitialize.Location = New System.Drawing.Point(320, 192)

        Me.pbrInitialize.Name = "pbrInitialize"

        Me.pbrInitialize.Size = New System.Drawing.Size(208, 16)

        Me.pbrInitialize.TabIndex = 1

        Me.pbrInitialize.Visible = False

        '

        'lblInitialize

        '

        Me.lblInitialize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.lblInitialize.ForeColor = System.Drawing.Color.Blue

        Me.lblInitialize.Location = New System.Drawing.Point(320, 216)

        Me.lblInitialize.Name = "lblInitialize"

        Me.lblInitialize.Size = New System.Drawing.Size(232, 16)

        Me.lblInitialize.TabIndex = 2

        Me.lblInitialize.Text = "Loading  game, Please wait . . ."

        Me.lblInitialize.Visible = False

        '

        'lblLinkGJWebSite

        '

        Me.lblLinkGJWebSite.Location = New System.Drawing.Point(160, 248)

        Me.lblLinkGJWebSite.Name = "lblLinkGJWebSite"

        Me.lblLinkGJWebSite.Size = New System.Drawing.Size(64, 16)

        Me.lblLinkGJWebSite.TabIndex = 3

        Me.lblLinkGJWebSite.TabStop = True

        Me.lblLinkGJWebSite.Text = "GJ Website"

        '

        'frmMain

        '

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)

        Me.ClientSize = New System.Drawing.Size(752, 625)

        Me.Controls.Add(Me.lblLinkGJWebSite)

        Me.Controls.Add(Me.lblInitialize)

        Me.Controls.Add(Me.pbrInitialize)

        Me.Controls.Add(Me.tbrGameMenu)

        Me.Menu = Me.mnuGameMenu

        Me.Name = "frmMain"

        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

        Me.Text = "GJ Memory Game"

        Me.WindowState = System.Windows.Forms.FormWindowState.Maximized

        Me.ResumeLayout(False)

 

    End Sub

 

#End Region

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'To initialize some controls

        'To initialize progress bar and progress label

        pbrInitialize.Visible = False

        lblInitialize.Visible = False

        'To initialize Module Global variables

        intCounterTryClicks = 0

        IsComputerCardCurrentGame = False

        IsGreekCardCurrentGame = False

        'To initialize Status Bar

        stbGameStatus.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        stbGameStatus.Dock = DockStyle.Bottom

        stbGameStatus.Text = "GJ - Computer/Greek Card Memory Game"

        'To initialize panel control

        pnlGamePanel.Visible = False

        Me.Controls.Add(stbGameStatus)

    End Sub

 

    Private Sub mnuFile_NewComputerCardsGame_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFile_NewComputerCardsGame.Click

        'To initialize new computer card game

        Call InitializeNewComputerCardsGame()

    End Sub

 

    Private Sub mnuFile_NewGreekCardsGame_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFile_NewGreekCardsGame.Click

        'To initialize new Greek card game

        Call InitializeNewGreekCardsGame()

    End Sub

 

    Private Sub tbrGameMenu_ButtonClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbrGameMenu.ButtonClick

        Select Case tbrGameMenu.Buttons.IndexOf(e.Button)

            Case 0

                'New Greek Cards Game

                Call InitializeNewGreekCardsGame()

            Case 2

                'New Computer Cards Game

                Call InitializeNewComputerCardsGame()

            Case 4

                'To close current game

                Call CloseCurrentGame()

            Case 6

                'To save current score into a text file

                Call SaveCurrentScore()

            Case 8

                'To display help window form

                Dim objfrmHelpText As New frmHelpText

                objfrmHelpText.ShowDialog()

            Case 10

                Me.Close()

        End Select

    End Sub

 

    Private Sub InitializeNewComputerCardsGame()

        ' To Populate Game Board with Computer Cards Game Pieces.

        ' X by Y is the size of the game board which depends on the screen resolution.

        ' Each Game Piece by default is assigned the default image (i.e., game piece is

        ' face down).  User clicks on a game piece to "turn the game piece over" to

        ' reveal the image of the game piece that is "face down".

        Dim intPieceWidth As Integer

        Dim intPieceHeight As Integer

        Dim intGapBetweenPieces As Integer

        Dim intNumRows As Integer

        Dim intNumCols As Integer

        Dim intCountRows As Integer

        Dim intCountCols As Integer

        Dim intEvenSentinel As Integer

        Dim intIndexInList As Integer

        Dim intNumImages As Integer

       

        intCounterTryClicks = 0

        intNumCurrentMatch = 0

        IsComputerCardCurrentGame = True

        IsGreekCardCurrentGame = False

        stbGameStatus.Text = "Loading a New Computer Card Game. . ."

        If CollectionComputerGamePieces.Count > 0 Then

            Call ClearPreviousGame(CollectionComputerGamePieces)

            Call RemoveAllItemsFromCollection(CollectionComputerGamePieces)

            pnlGamePanel.Visible = False

            Me.Controls.Remove(pnlGamePanel)

        End If

        If CollectionGreekGamePieces.Count > 0 Then

            Call ClearPreviousGame(CollectionGreekGamePieces)

            Call RemoveAllItemsFromCollection(CollectionGreekGamePieces)

            pnlGamePanel.Visible = False

            Me.Controls.Remove(pnlGamePanel)

        End If

 

        pbrInitialize.Top = (Screen.PrimaryScreen.WorkingArea.Height / 2) - (pbrInitialize.Height / 2) - tbrGameMenu.Height

        pbrInitialize.Left = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (pbrInitialize.Width / 2)

        lblInitialize.Top = pbrInitialize.Top + (1.5 * pbrInitialize.Height)

        lblInitialize.Left = pbrInitialize.Left

        pbrInitialize.Visible = True

        lblInitialize.Visible = True

        pbrInitialize.Refresh()

        lblInitialize.Refresh()

        'To assign a potential width to our Game Board dynamically in function to the user screen resolution.

        BoardWidth = 0.3 * Screen.PrimaryScreen.WorkingArea.Width

        'To assig dimension of the game piece

        intPieceWidth = 54

        intPieceHeight = intPieceWidth

        'To assign gap between pieces

        intGapBetweenPieces = Int(intPieceWidth / 3)

        'To get possible number of rows that will fit into de game board

        intNumRows = Int(BoardWidth / (intPieceWidth + (1.5 * intGapBetweenPieces)))

        intEvenSentinel = intNumRows Mod 2 'To Check if the intNumRwos is an even number

        If intEvenSentinel <> 0 Then 'If the intNumRows is an Odd number

            'Add an additional Row

            intNumRows += 1

        End If

        'To make room into the game board for an even number of rows and columns

        BoardWidth = intNumRows * intPieceWidth + (intNumRows + 1) * intGapBetweenPieces

        'To assig number of columns for the game board

        intNumCols = intNumRows

        'To assign the height of the Game Board

        BoardHeight = BoardWidth

        intNumImages = CInt(intNumRows * intNumRows)

        intNumMatch = Int(intNumImages / 2)

        'To assign the Location(x,y) of the game board

        XLocation = (Screen.PrimaryScreen.WorkingArea.Width - BoardWidth) / 2

        YLocation = (Screen.PrimaryScreen.WorkingArea.Height - BoardHeight) / 3 - tbrGameMenu.Height

        pbrInitialize.Minimum = 1

        pbrInitialize.Maximum = 3 * intNumCols * intNumCols

        pbrInitialize.Value = 1

        pbrInitialize.Step = 1

        intIndexInList = 0

        For intCountCols = 1 To intNumCols

            pbrInitialize.PerformStep()

            For intCountRows = 1 To intNumRows

                pbrInitialize.PerformStep()

                'To define a object GamePiece and put into the Game Board

                'The position of each game piece will be determined dynamically in function of the

                'Game Boar Location,Width of the piece,height of the piece,and gap between pieces.

                Dim objGamePiece As New GamePiece(Me, XLocation + ((intCountRows - 1) * intPieceWidth) + (intCountRows * intGapBetweenPieces), _

                                                  YLocation + ((intCountCols - 1) * intPieceWidth) + (intCountCols * intGapBetweenPieces), _

                                                  intPieceWidth, _

                                                  intPieceHeight)

                objGamePiece.btnGamePiece.ImageList = lstComputerCards

                'To store each objGamePiece object into a Collection

                CollectionComputerGamePieces.Add(objGamePiece)

            Next

        Next

        lstComputerCards.ImageSize = New Size(32, 32)

        Call LoadComputerCardsImages(intNumRows * intNumRows)

        pbrInitialize.PerformStep()

        Dim objComputerCardsGameBoard As New GameBoard(Me, XLocation, YLocation, BoardWidth, BoardHeight)

        pbrInitialize.Value = pbrInitialize.Maximum

        pbrInitialize.Visible = False

        lblInitialize.Visible = False

        stbGameStatus.Text = "Ready to Play a New Computer Card Game. . . Good Luck"

    End Sub

 

    Private Sub InitializeNewGreekCardsGame()

        ' To Populate Game Board with Computer Cards Game Pieces.

        ' X by Y is the size of the game board which depends on the screen resolution.

        ' Each Game Piece by default is assigned the default image (i.e., game piece is

        ' face down).  User clicks on a game piece to "turn the game piece over" to

        ' reveal the image of the game piece that is "face down".

        Dim intPieceWidth As Integer

        Dim intPieceHeight As Integer

        Dim intGapBetweenPieces As Integer

        Dim intNumRows As Integer

        Dim intNumCols As Integer

        Dim intCountRows As Integer

        Dim intCountCols As Integer

        Dim intEvenSentinel As Integer

        Dim intIndexInList As Integer

        Dim intNumImages As Integer

 

        intCounterTryClicks = 0

        intNumCurrentMatch = 0

        IsComputerCardCurrentGame = False

        IsGreekCardCurrentGame = True

        stbGameStatus.Text = "Loading a New Greek Card Game. . ."

        If CollectionGreekGamePieces.Count > 0 Then

            Call ClearPreviousGame(CollectionGreekGamePieces)

            Call RemoveAllItemsFromCollection(CollectionGreekGamePieces)

            pnlGamePanel.Visible = False

            Me.Controls.Remove(pnlGamePanel)

        End If

        If CollectionComputerGamePieces.Count > 0 Then

            Call ClearPreviousGame(CollectionComputerGamePieces)

            Call RemoveAllItemsFromCollection(CollectionComputerGamePieces)

            pnlGamePanel.Visible = False

            Me.Controls.Remove(pnlGamePanel)

        End If

 

        pbrInitialize.Top = (Screen.PrimaryScreen.WorkingArea.Height / 2) - (pbrInitialize.Height / 2) - tbrGameMenu.Height

        pbrInitialize.Left = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (pbrInitialize.Width / 2)

        lblInitialize.Top = pbrInitialize.Top + (1.5 * pbrInitialize.Height)

        lblInitialize.Left = pbrInitialize.Left

        pbrInitialize.Visible = True

        lblInitialize.Visible = True

        pbrInitialize.Refresh()

        lblInitialize.Refresh()

        'To assign a potential width to our Game Board dynamically in function to the user screen resolution.

        BoardWidth = 0.3 * Screen.PrimaryScreen.WorkingArea.Width

        'To assig dimension of the game piece

        intPieceWidth = 60

        intPieceHeight = intPieceWidth

        'To assign gap between pieces

        intGapBetweenPieces = Int(intPieceWidth / 3)

        'To get possible number of rows that will fit into de game board

        intNumRows = Int(BoardWidth / (intPieceWidth + (1.5 * intGapBetweenPieces)))

        intEvenSentinel = intNumRows Mod 2 'To Check if the intNumRwos is an even number

        If intEvenSentinel <> 0 Then 'If the intNumRows is an Odd number

            'To add an additional Row

            intNumRows += 1

        End If

        'To make room into the game board for an even number of rows and columns

        BoardWidth = intNumRows * intPieceWidth + (intNumRows + 1) * intGapBetweenPieces

        'To assig number of columns for the game board

        intNumCols = intNumRows

        'To assign the height of the Game Board

        BoardHeight = BoardWidth

        intNumImages = CInt(intNumRows * intNumRows)

        intNumMatch = Int(intNumImages / 2)

        'To assign the Location(x,y) of the game board

        XLocation = (Screen.PrimaryScreen.WorkingArea.Width - BoardWidth) / 2

        YLocation = (Screen.PrimaryScreen.WorkingArea.Height - BoardHeight) / 3 - tbrGameMenu.Height

        pbrInitialize.Minimum = 1

        pbrInitialize.Maximum = 3 * intNumCols * intNumCols

        pbrInitialize.Value = 1

        pbrInitialize.Step = 1

        intIndexInList = 0

        For intCountCols = 1 To intNumCols

            pbrInitialize.PerformStep()

            For intCountRows = 1 To intNumRows

                pbrInitialize.PerformStep()

                'To define a object GamePiece and put into the Game Board

                'The position of each game piece will be determined dynamically in function of the

                'Game Boar Location,Width of the piece,height of the piece,and gap between pieces.

                Dim objGamePiece As New GamePiece(Me, XLocation + ((intCountRows - 1) * intPieceWidth) + (intCountRows * intGapBetweenPieces), _

                                                  YLocation + ((intCountCols - 1) * intPieceWidth) + (intCountCols * intGapBetweenPieces), _

                                                  intPieceWidth, _

                                                  intPieceHeight)

                objGamePiece.btnGamePiece.ImageList = lstGreekCards

                'To store each objGamePiece object into a Collection

                CollectionGreekGamePieces.Add(objGamePiece)

            Next

        Next

        lstGreekCards.ImageSize = New Size(60, 60)

        Call LoadGreekCardsImages(intNumRows * intNumRows)

        pbrInitialize.PerformStep()

        Dim objGreekCardsGameBoard As New GameBoard(Me, XLocation, YLocation, BoardWidth, BoardHeight)

        pbrInitialize.Value = pbrInitialize.Maximum

        pbrInitialize.Visible = False

        lblInitialize.Visible = False

        stbGameStatus.Text = "Ready to Play a New Greek Card Game. . . Good Luck"

    End Sub

 

    Private Sub LoadComputerCardsImages(ByVal intNumImages As Integer)

        'To load Computer cards images into Computer Cards List randomly

        Dim intNumDistinctImages As Integer

        Dim intCount As Integer

        Dim intRandomStartIndex As Integer

        Dim arrIdxArray() As Integer          ' Declare  array variable.

        Dim arrIdxRandomArray() As Integer   ' Declare  array variable.

        Dim intIndex As Integer

        Dim intValue As Integer

        intNumDistinctImages = Int(intNumImages / 2)

        Randomize() ' Initialize random-number generator.

        intRandomStartIndex = CInt(Int((intNumDistinctImages * Rnd()) + 1)) ' Generate random value between 1 and intNumDistinctImages.

 

        pbrInitialize.PerformStep()

        ReDim arrIdxArray(2 * intNumDistinctImages - 1)  ' Allocate 2*intNumDistinctImages elements.

        ReDim arrIdxRandomArray(2 * intNumDistinctImages - 1) ' Allocate 2*intNumDistinctImages elements.

        intValue = 1

        For intCount = 0 To UBound(arrIdxArray)

            arrIdxArray(intCount) = intValue    ' Initialize array.

            intValue = intValue + 1

            If (intCount + 1) = intNumDistinctImages Then

                intValue = 1

            End If

        Next intCount

        'Populate arrIdxRandomArray using arrIdxArray elements with random position

        intIndex = 0

        For intCount = intRandomStartIndex To UBound(arrIdxRandomArray)

            If intIndex <= UBound(arrIdxRandomArray) Then

                arrIdxRandomArray(intIndex) = arrIdxArray(intCount)

                intIndex = intIndex + 1

            End If

        Next intCount

        For intCount = intRandomStartIndex - 1 To LBound(arrIdxRandomArray) Step -1

            If intIndex >= LBound(arrIdxRandomArray) Then

                arrIdxRandomArray(intIndex) = arrIdxArray(intCount)

                intIndex = intIndex + 1

            End If

        Next intCount

        lstComputerCards.Images.Clear()

        For intCount = 0 To UBound(arrIdxRandomArray)

            pbrInitialize.PerformStep()

            Dim myImage As System.Drawing.Image = Image.FromFile(Application.StartupPath & "\ComputerIcons\ComputerCard" & CStr(arrIdxRandomArray(intCount)) & ".gif")

            lstComputerCards.Images.Add(myImage)

        Next

        intIndex = 0

        For Each objGamePiece As GamePiece In CollectionComputerGamePieces   ' Iterate through elements.

            pbrInitialize.PerformStep()

            objGamePiece.btnGamePiece.Name = (arrIdxRandomArray(intIndex) - 1).ToString

            intIndex = intIndex + 1

        Next

 

    End Sub

 

    Private Sub LoadGreekCardsImages(ByVal intNumImages As Integer)

        'To load Greek cards images into Greek Cards List randomly

        Dim intNumDistinctImages As Integer

        Dim intCount As Integer

        Dim intRandomStartIndex As Integer

        Dim arrIdxArray() As Integer          ' Declare  array variable.

        Dim arrIdxRandomArray() As Integer   ' Declare  array variable.

        Dim intIndex As Integer

        Dim intValue As Integer

        intNumDistinctImages = Int(intNumImages / 2)

        Randomize() ' Initialize random-number generator.

        intRandomStartIndex = CInt(Int((intNumDistinctImages * Rnd()) + 1)) ' Generate random value between 1 and intNumDistinctImages.

 

        ReDim arrIdxArray(2 * intNumDistinctImages - 1)  ' Allocate 2*intNumDistinctImages elements.

        ReDim arrIdxRandomArray(2 * intNumDistinctImages - 1) ' Allocate 2*intNumDistinctImages elements.

        intValue = 1

        For intCount = 0 To UBound(arrIdxArray)

            arrIdxArray(intCount) = intValue    ' Initialize array.

            intValue = intValue + 1

            If (intCount + 1) = intNumDistinctImages Then

                intValue = 1

            End If

        Next intCount

        'Populate arrIdxRandomArray using arrIdxArray elements with random position

        intIndex = 0

        For intCount = intRandomStartIndex To UBound(arrIdxRandomArray)

            If intIndex <= UBound(arrIdxRandomArray) Then

                arrIdxRandomArray(intIndex) = arrIdxArray(intCount)

                intIndex = intIndex + 1

            End If

        Next intCount

 

        For intCount = intRandomStartIndex - 1 To LBound(arrIdxRandomArray) Step -1

            If intIndex >= LBound(arrIdxRandomArray) Then

                arrIdxRandomArray(intIndex) = arrIdxArray(intCount)

                intIndex = intIndex + 1

            End If

        Next intCount

        lstGreekCards.Images.Clear()

        For intCount = 0 To UBound(arrIdxRandomArray)

            pbrInitialize.PerformStep()

            Dim myImage As System.Drawing.Image = Image.FromFile(Application.StartupPath & "\GreekCards\GreekCard" & CStr(arrIdxRandomArray(intCount)) & ".jpg")

            lstGreekCards.Images.Add(myImage)

        Next

 

        intIndex = 0

        For Each objGamePiece As GamePiece In CollectionGreekGamePieces   ' Iterate through elements.

            pbrInitialize.PerformStep()

            objGamePiece.btnGamePiece.Name = (arrIdxRandomArray(intIndex) - 1).ToString

            intIndex = intIndex + 1

        Next

 

    End Sub

 

    Private Sub ClearPreviousGame(ByVal CollectionGamePieces As Collection)

        'To clear previous game

        Dim objMyInternalGamePiece As GamePiece

        For Each objMyInternalGamePiece In CollectionGamePieces

            objMyInternalGamePiece.btnGamePiece.Visible = False

        Next

    End Sub

 

    Private Sub RemoveAllItemsFromCollection(ByVal CollectionGamePieces As Collection)

        'To remove all items stored in the Game Pieces' collection

        Dim objMyInternalGamePiece As GamePiece

        Dim intIndex As Integer

        Dim intCount As Integer

        intIndex = 1

        While CollectionGamePieces.Count > 0

            CollectionGamePieces.Remove(intIndex)

        End While

    End Sub

 

    Private Sub Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFile_Exit.Click

        Me.Close()

    End Sub

 

    Private Sub mnuFile_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFile_Save.Click

        'To save current score

        Call SaveCurrentScore()

    End Sub

 

    Private Sub mnuFile_Close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFile_Close.Click

        'To close current game

        Call CloseCurrentGame()

    End Sub

    Private Sub CloseCurrentGame()

        'To close current game

        intCounterTryClicks = 0

        IsComputerCardCurrentGame = False

        IsGreekCardCurrentGame = False

        stbGameStatus.Text = "GJ - Computer/Greek Card Memory Game"

        If CollectionGreekGamePieces.Count > 0 Then

            Call ClearPreviousGame(CollectionGreekGamePieces)

            Call RemoveAllItemsFromCollection(CollectionGreekGamePieces)

            pnlGamePanel.Visible = False

            Me.Controls.Remove(pnlGamePanel)

        End If

        If CollectionComputerGamePieces.Count > 0 Then

            Call ClearPreviousGame(CollectionComputerGamePieces)

            Call RemoveAllItemsFromCollection(CollectionComputerGamePieces)

            pnlGamePanel.Visible = False

            Me.Controls.Remove(pnlGamePanel)

        End If

    End Sub

    Private Sub SaveCurrentScore()

        'To save a curent score into a text file

        Dim strFileName As String

        Dim bolFileWasSavedSuccessfully As Boolean

        If IsComputerCardCurrentGame = True Then

            strFileName = "MyComputerGameScore"

        ElseIf IsGreekCardCurrentGame = True Then

            strFileName = "MyGreekGameScore"

        End If

        Try

            With sfdSaveScore

                .DefaultExt = "txt"

                .FileName = strFileName

                .Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"

                .FilterIndex = 1

                .InitialDirectory = "C:\"

                .OverwritePrompt = True

                .Title = "GJ Memory Game- Save"

            End With

            bolFileWasSavedSuccessfully = False

            If sfdSaveScore.ShowDialog = DialogResult.OK Then

                strFileName = sfdSaveScore.FileName

                Dim objWriter As StreamWriter = New StreamWriter(strFileName, False)

                If IsComputerCardCurrentGame = True Then

                    If intNumCurrentMatch = intNumMatch Then

                        objWriter.Write("Computer Card Game Score : " & CStr(intCounterTryClicks) & " tries.")

                    Else

                        objWriter.Write("Computer Card Game Partial Score : " & CStr(intCounterTryClicks) & " tries with " & CStr(intNumCurrentMatch) & " matches (you needed " & CStr(intNumMatch) & " total matches to complete the game).")

                    End If

                    objWriter.Close()

                    objWriter = Nothing

                ElseIf IsGreekCardCurrentGame = True Then

                    If intNumCurrentMatch = intNumMatch Then

                        objWriter.Write("Greek Card Game Score : " & CStr(intCounterTryClicks) & " tries.")

                    Else

                        objWriter.Write("Greek Card Game Partial Score : " & CStr(intCounterTryClicks) & " tries with " & CStr(intNumCurrentMatch) & " matches (you needed " & CStr(intNumMatch) & " total matches to complete the game).")

                    End If

 

                    objWriter.Close()

                    objWriter = Nothing

                End If

                bolFileWasSavedSuccessfully = True

            End If

        Catch ex As Exception

            MsgBox("Can't Save Game Score" & vbCrLf & ex.Message, MsgBoxStyle.Critical, "Error Saving Score")

 

        Finally

            If bolFileWasSavedSuccessfully = True Then

                MsgBox("Score Game was Saved Successfully !!!", MsgBoxStyle.Information, "Save Game Score")

            End If

        End Try

    End Sub

 

 

    Private Sub mnuHelp_About_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHelp_About.Click

        'To display About window form

        Dim objfrmAbout As New frmAbout

        objfrmAbout.ShowDialog()

 

    End Sub

 

    Private Sub mnuHelp_Text_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHelp_Text.Click

        'To display Help window form

        Dim objfrmHelpText As New frmHelpText

        objfrmHelpText.ShowDialog()

    End Sub

 

    Private Sub mnuWebSite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuWebSite.Click

        'To link to GJ web site

        Call LinkToGJWebSite()

    End Sub

 

    Private Sub lblLinkGJWebSite_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblLinkGJWebSite.LinkClicked

        Call LinkToGJWebSite()

    End Sub

    Private Sub LinkToGJWebSite()

        Dim p As New ProcessStartInfo

        p.FileName = "http://www.gjp2s.com"

        p.UseShellExecute = True

        Process.Start(p)

    End Sub

 

    Private Sub mnuView_ShowScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuView_ShowScore.Click

        'To show current score for a completed game or incompleted game

        If pnlGamePanel.Visible = True Then

            If intNumCurrentMatch = intNumMatch Then

                'Score for a completed game

                MessageBox.Show("Your Total Score was : " & CStr(intCounterTryClicks) & " tries.", _

                                "Total Score", _

                                MessageBoxButtons.OK, _

                                MessageBoxIcon.Information, _

                                MessageBoxDefaultButton.Button1)

            Else

                'Partial score for an incompleted game

                MessageBox.Show("Your Partial Current Score is : " & CStr(intCounterTryClicks) & " tries with " & CStr(intNumCurrentMatch) & " matches (you need " & CStr(intNumMatch) & " total matches to complete the game).", _

                                "Partial Score", _

                                MessageBoxButtons.OK, _

                                MessageBoxIcon.Information, _

                                MessageBoxDefaultButton.Button1)

            End If

        Else

            MessageBox.Show("In Order to get a score please select a game and play it, Thank you.", _

                            "No game selected yet", _

                            MessageBoxButtons.OK, _

                            MessageBoxIcon.Information, _

                            MessageBoxDefaultButton.Button1)

        End If

    End Sub

End Class

 

'MSSE Fairfield University

'SW403- Fall 2005

'Guillermo V. Julca

'http://www.gjp2s.com

 

Public Class frmHelpText

    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 PictureBox1 As System.Windows.Forms.PictureBox

    Friend WithEvents PictureBox4 As System.Windows.Forms.PictureBox

    Friend WithEvents PictureBox5 As System.Windows.Forms.PictureBox

    Friend WithEvents Label1 As System.Windows.Forms.Label

    Friend WithEvents Label2 As System.Windows.Forms.Label

    Friend WithEvents Label3 As System.Windows.Forms.Label

    Friend WithEvents Label4 As System.Windows.Forms.Label

    Friend WithEvents Label5 As System.Windows.Forms.Label

    Friend WithEvents PictureBox6 As System.Windows.Forms.PictureBox

    Friend WithEvents PictureBox7 As System.Windows.Forms.PictureBox

    Friend WithEvents lblTextHelp As System.Windows.Forms.Label

    Friend WithEvents PictureBox8 As System.Windows.Forms.PictureBox

    Friend WithEvents PictureBox9 As System.Windows.Forms.PictureBox

    Friend WithEvents Label7 As System.Windows.Forms.Label

    Friend WithEvents Label8 As System.Windows.Forms.Label

    Friend WithEvents Label9 As System.Windows.Forms.Label

    Friend WithEvents Label10 As System.Windows.Forms.Label

    Friend WithEvents Button1 As System.Windows.Forms.Button

    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList

    Friend WithEvents Button2 As System.Windows.Forms.Button

    Friend WithEvents Button3 As System.Windows.Forms.Button

    Friend WithEvents Button4 As System.Windows.Forms.Button

    Friend WithEvents Label11 As System.Windows.Forms.Label

    Friend WithEvents Button5 As System.Windows.Forms.Button

    Friend WithEvents Button6 As System.Windows.Forms.Button

    Friend WithEvents Label12 As System.Windows.Forms.Label

    Friend WithEvents Button7 As System.Windows.Forms.Button

    Friend WithEvents lblToolbalDescription As System.Windows.Forms.Label

    Friend WithEvents lblHowToPlay As System.Windows.Forms.Label

    Friend WithEvents Label6 As System.Windows.Forms.Label

    Friend WithEvents Label13 As System.Windows.Forms.Label

    Friend WithEvents Label14 As System.Windows.Forms.Label

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        Me.components = New System.ComponentModel.Container

        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmHelpText))

        Me.PictureBox1 = New System.Windows.Forms.PictureBox

        Me.PictureBox4 = New System.Windows.Forms.PictureBox

        Me.PictureBox5 = New System.Windows.Forms.PictureBox

        Me.Label1 = New System.Windows.Forms.Label

        Me.Label2 = New System.Windows.Forms.Label

        Me.Label3 = New System.Windows.Forms.Label

        Me.Label4 = New System.Windows.Forms.Label

        Me.Label5 = New System.Windows.Forms.Label

        Me.lblToolbalDescription = New System.Windows.Forms.Label

        Me.PictureBox6 = New System.Windows.Forms.PictureBox

        Me.PictureBox7 = New System.Windows.Forms.PictureBox

        Me.lblTextHelp = New System.Windows.Forms.Label

        Me.PictureBox8 = New System.Windows.Forms.PictureBox

        Me.PictureBox9 = New System.Windows.Forms.PictureBox

        Me.Label7 = New System.Windows.Forms.Label

        Me.Label8 = New System.Windows.Forms.Label

        Me.Label9 = New System.Windows.Forms.Label

        Me.Label10 = New System.Windows.Forms.Label

        Me.Button1 = New System.Windows.Forms.Button

        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)

        Me.Button2 = New System.Windows.Forms.Button

        Me.Button3 = New System.Windows.Forms.Button

        Me.Button4 = New System.Windows.Forms.Button

        Me.Label11 = New System.Windows.Forms.Label

        Me.Button5 = New System.Windows.Forms.Button

        Me.Button6 = New System.Windows.Forms.Button

        Me.Label12 = New System.Windows.Forms.Label

        Me.Button7 = New System.Windows.Forms.Button

        Me.lblHowToPlay = New System.Windows.Forms.Label

        Me.Label6 = New System.Windows.Forms.Label

        Me.Label13 = New System.Windows.Forms.Label

        Me.Label14 = New System.Windows.Forms.Label

        Me.SuspendLayout()

        '

        'PictureBox1

        '

        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)

        Me.PictureBox1.Location = New System.Drawing.Point(56, 456)

        Me.PictureBox1.Name = "PictureBox1"

        Me.PictureBox1.Size = New System.Drawing.Size(32, 32)

        Me.PictureBox1.TabIndex = 1

        Me.PictureBox1.TabStop = False

        '

        'PictureBox4

        '

        Me.PictureBox4.Image = CType(resources.GetObject("PictureBox4.Image"), System.Drawing.Image)

        Me.PictureBox4.Location = New System.Drawing.Point(56, 552)

        Me.PictureBox4.Name = "PictureBox4"

        Me.PictureBox4.Size = New System.Drawing.Size(32, 32)

        Me.PictureBox4.TabIndex = 4

        Me.PictureBox4.TabStop = False

        '

        'PictureBox5

        '

        Me.PictureBox5.Image = CType(resources.GetObject("PictureBox5.Image"), System.Drawing.Image)

        Me.PictureBox5.Location = New System.Drawing.Point(56, 648)

        Me.PictureBox5.Name = "PictureBox5"

        Me.PictureBox5.Size = New System.Drawing.Size(32, 32)

        Me.PictureBox5.TabIndex = 5

        Me.PictureBox5.TabStop = False

        '

        'Label1

        '

        Me.Label1.BackColor = System.Drawing.Color.White

        Me.Label1.Location = New System.Drawing.Point(104, 416)

        Me.Label1.Name = "Label1"

        Me.Label1.Size = New System.Drawing.Size(320, 24)

        Me.Label1.TabIndex = 6

        Me.Label1.Text = "Shortcut button to initialize a new Greek Card Game ."

        '

        'Label2

        '

        Me.Label2.BackColor = System.Drawing.Color.White

        Me.Label2.Location = New System.Drawing.Point(104, 464)

        Me.Label2.Name = "Label2"

        Me.Label2.Size = New System.Drawing.Size(320, 24)

        Me.Label2.TabIndex = 7

        Me.Label2.Text = "Shortcut button to initialize a new Computer Card Game ."

        '

        'Label3

        '

        Me.Label3.BackColor = System.Drawing.Color.White

        Me.Label3.Location = New System.Drawing.Point(104, 512)

        Me.Label3.Name = "Label3"

        Me.Label3.Size = New System.Drawing.Size(320, 24)

        Me.Label3.TabIndex = 8

        Me.Label3.Text = "Shortcut button to close any current game."

        '

        'Label4

        '

        Me.Label4.BackColor = System.Drawing.Color.White

        Me.Label4.Location = New System.Drawing.Point(104, 560)

        Me.Label4.Name = "Label4"

        Me.Label4.Size = New System.Drawing.Size(320, 24)

        Me.Label4.TabIndex = 9

        Me.Label4.Text = "Shortcut button to save current score into a text file."

        '

        'Label5

        '

        Me.Label5.BackColor = System.Drawing.Color.White

        Me.Label5.Location = New System.Drawing.Point(104, 656)

        Me.Label5.Name = "Label5"

        Me.Label5.Size = New System.Drawing.Size(320, 24)

        Me.Label5.TabIndex = 10

        Me.Label5.Text = "Shortcut button to exit from the program."

        '

        'lblToolbalDescription

        '

        Me.lblToolbalDescription.BackColor = System.Drawing.Color.White

        Me.lblToolbalDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.lblToolbalDescription.Location = New System.Drawing.Point(56, 376)

        Me.lblToolbalDescription.Name = "lblToolbalDescription"

        Me.lblToolbalDescription.Size = New System.Drawing.Size(312, 24)

        Me.lblToolbalDescription.TabIndex = 11

        Me.lblToolbalDescription.Text = "Tool bar shortcuts buttons description :"

        '

        'PictureBox6

        '

        Me.PictureBox6.Image = CType(resources.GetObject("PictureBox6.Image"), System.Drawing.Image)

        Me.PictureBox6.Location = New System.Drawing.Point(56, 320)

        Me.PictureBox6.Name = "PictureBox6"

        Me.PictureBox6.Size = New System.Drawing.Size(32, 32)

        Me.PictureBox6.TabIndex = 12

        Me.PictureBox6.TabStop = False

        '

        'PictureBox7

        '

        Me.PictureBox7.Image = CType(resources.GetObject("PictureBox7.Image"), System.Drawing.Image)

        Me.PictureBox7.Location = New System.Drawing.Point(96, 320)

        Me.PictureBox7.Name = "PictureBox7"

        Me.PictureBox7.Size = New System.Drawing.Size(32, 32)

        Me.PictureBox7.TabIndex = 13

        Me.PictureBox7.TabStop = False

        '

        'lblTextHelp

        '

        Me.lblTextHelp.BackColor = System.Drawing.Color.White

        Me.lblTextHelp.Location = New System.Drawing.Point(16, 0)

        Me.lblTextHelp.Name = "lblTextHelp"

        Me.lblTextHelp.Size = New System.Drawing.Size(576, 688)

        Me.lblTextHelp.TabIndex = 0

        '

        'PictureBox8

        '

        Me.PictureBox8.Image = CType(resources.GetObject("PictureBox8.Image"), System.Drawing.Image)

        Me.PictureBox8.Location = New System.Drawing.Point(136, 320)

        Me.PictureBox8.Name = "PictureBox8"

        Me.PictureBox8.Size = New System.Drawing.Size(32, 32)

        Me.PictureBox8.TabIndex = 14

        Me.PictureBox8.TabStop = False

        '

        'PictureBox9

        '

        Me.PictureBox9.Image = CType(resources.GetObject("PictureBox9.Image"), System.Drawing.Image)

        Me.PictureBox9.Location = New System.Drawing.Point(216, 320)

        Me.PictureBox9.Name = "PictureBox9"

        Me.PictureBox9.Size = New System.Drawing.Size(32, 32)

        Me.PictureBox9.TabIndex = 15

        Me.PictureBox9.TabStop = False

        '

        'Label7

        '

        Me.Label7.BackColor = System.Drawing.Color.White

        Me.Label7.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label7.Location = New System.Drawing.Point(176, 328)

        Me.Label7.Name = "Label7"

        Me.Label7.Size = New System.Drawing.Size(32, 24)

        Me.Label7.TabIndex = 16

        Me.Label7.Text = ". . ."

        '

        'Label8

        '

        Me.Label8.BackColor = System.Drawing.Color.White

        Me.Label8.Location = New System.Drawing.Point(272, 328)

        Me.Label8.Name = "Label8"

        Me.Label8.Size = New System.Drawing.Size(160, 24)

        Me.Label8.TabIndex = 17

        Me.Label8.Text = "Set of Computer Image Cards"

        '

        'Label9

        '

        Me.Label9.BackColor = System.Drawing.Color.White

        Me.Label9.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label9.Location = New System.Drawing.Point(176, 280)

        Me.Label9.Name = "Label9"

        Me.Label9.Size = New System.Drawing.Size(32, 24)

        Me.Label9.TabIndex = 22

        Me.Label9.Text = ". . ."

        '

        'Label10

        '

        Me.Label10.BackColor = System.Drawing.Color.White

        Me.Label10.Location = New System.Drawing.Point(272, 280)

        Me.Label10.Name = "Label10"

        Me.Label10.Size = New System.Drawing.Size(160, 24)

        Me.Label10.TabIndex = 23

        Me.Label10.Text = "Set of Greek Alphabet Cards"

        '

        'Button1

        '

        Me.Button1.ImageIndex = 0

        Me.Button1.ImageList = Me.ImageList1

        Me.Button1.Location = New System.Drawing.Point(56, 272)

        Me.Button1.Name = "Button1"

        Me.Button1.Size = New System.Drawing.Size(32, 32)

        Me.Button1.TabIndex = 24

        '

        'ImageList1

        '

        Me.ImageList1.ImageSize = New System.Drawing.Size(32, 32)

        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)

        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent

        '

        'Button2

        '

        Me.Button2.ImageIndex = 1

        Me.Button2.ImageList = Me.ImageList1

        Me.Button2.Location = New System.Drawing.Point(96, 272)

        Me.Button2.Name = "Button2"

        Me.Button2.Size = New System.Drawing.Size(32, 32)

        Me.Button2.TabIndex = 25

        '

        'Button3

        '

        Me.Button3.ImageIndex = 2

        Me.Button3.ImageList = Me.ImageList1

        Me.Button3.Location = New System.Drawing.Point(136, 272)

        Me.Button3.Name = "Button3"

        Me.Button3.Size = New System.Drawing.Size(32, 32)

        Me.Button3.TabIndex = 26

        '

        'Button4

        '

        Me.Button4.ImageIndex = 3

        Me.Button4.ImageList = Me.ImageList1

        Me.Button4.Location = New System.Drawing.Point(216, 272)

        Me.Button4.Name = "Button4"

        Me.Button4.Size = New System.Drawing.Size(32, 32)

        Me.Button4.TabIndex = 27

        '

        'Label11

        '

        Me.Label11.BackColor = System.Drawing.Color.White

        Me.Label11.Location = New System.Drawing.Point(56, 240)

        Me.Label11.Name = "Label11"

        Me.Label11.Size = New System.Drawing.Size(456, 16)

        Me.Label11.TabIndex = 28

        Me.Label11.Text = "This game will allow to you to play with two different set of cards :"

        '

        'Button5

        '

        Me.Button5.ImageIndex = 0

        Me.Button5.ImageList = Me.ImageList1

        Me.Button5.Location = New System.Drawing.Point(56, 408)

        Me.Button5.Name = "Button5"

        Me.Button5.Size = New System.Drawing.Size(32, 32)

        Me.Button5.TabIndex = 29

        '

        'Button6

        '

        Me.Button6.ImageIndex = 5

        Me.Button6.ImageList = Me.ImageList1

        Me.Button6.Location = New System.Drawing.Point(56, 600)

        Me.Button6.Name = "Button6"

        Me.Button6.Size = New System.Drawing.Size(32, 32)

        Me.Button6.TabIndex = 30

        '

        'Label12

        '

        Me.Label12.BackColor = System.Drawing.Color.White

        Me.Label12.Location = New System.Drawing.Point(104, 608)

        Me.Label12.Name = "Label12"

        Me.Label12.Size = New System.Drawing.Size(320, 24)

        Me.Label12.TabIndex = 31

        Me.Label12.Text = "Shortcut button to get help window."

        '

        'Button7

        '

        Me.Button7.ImageIndex = 6

        Me.Button7.ImageList = Me.ImageList1

        Me.Button7.Location = New System.Drawing.Point(56, 504)

        Me.Button7.Name = "Button7"

        Me.Button7.Size = New System.Drawing.Size(32, 32)

        Me.Button7.TabIndex = 32

        '

        'lblHowToPlay

        '

        Me.lblHowToPlay.BackColor = System.Drawing.Color.White

        Me.lblHowToPlay.Location = New System.Drawing.Point(56, 40)

        Me.lblHowToPlay.Name = "lblHowToPlay"

        Me.lblHowToPlay.Size = New System.Drawing.Size(480, 120)

        Me.lblHowToPlay.TabIndex = 33

        Me.lblHowToPlay.Text = "Text declared dynamically..."

        '

        'Label6

        '

        Me.Label6.BackColor = System.Drawing.Color.White

        Me.Label6.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label6.Location = New System.Drawing.Point(56, 16)

        Me.Label6.Name = "Label6"

        Me.Label6.Size = New System.Drawing.Size(312, 24)

        Me.Label6.TabIndex = 34

        Me.Label6.Text = "How to Play :"

        '

        'Label13

        '

        Me.Label13.BackColor = System.Drawing.Color.White

        Me.Label13.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label13.Location = New System.Drawing.Point(56, 168)

        Me.Label13.Name = "Label13"

        Me.Label13.Size = New System.Drawing.Size(312, 24)

        Me.Label13.TabIndex = 35

        Me.Label13.Text = "About the Score :"

        '

        'Label14

        '

        Me.Label14.BackColor = System.Drawing.Color.White

        Me.Label14.Location = New System.Drawing.Point(56, 200)

        Me.Label14.Name = "Label14"

        Me.Label14.Size = New System.Drawing.Size(480, 24)

        Me.Label14.TabIndex = 36

        Me.Label14.Text = "- The System will count the number of tries (lowest is best)."

        '

        'frmHelpText

        '

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

        Me.AutoScroll = True

        Me.AutoScrollMinSize = New System.Drawing.Size(10, 10)

        Me.ClientSize = New System.Drawing.Size(576, 587)

        Me.Controls.Add(Me.Label14)

        Me.Controls.Add(Me.Label13)

        Me.Controls.Add(Me.Label6)

        Me.Controls.Add(Me.lblHowToPlay)

        Me.Controls.Add(Me.Button7)

        Me.Controls.Add(Me.Label12)

        Me.Controls.Add(Me.Button6)

        Me.Controls.Add(Me.Button5)

        Me.Controls.Add(Me.Label11)

        Me.Controls.Add(Me.Button4)

        Me.Controls.Add(Me.Button3)

        Me.Controls.Add(Me.Button2)

        Me.Controls.Add(Me.Button1)

        Me.Controls.Add(Me.Label10)

        Me.Controls.Add(Me.Label9)

        Me.Controls.Add(Me.Label8)

        Me.Controls.Add(Me.Label7)

        Me.Controls.Add(Me.PictureBox9)

        Me.Controls.Add(Me.PictureBox8)

        Me.Controls.Add(Me.PictureBox7)

        Me.Controls.Add(Me.PictureBox6)

        Me.Controls.Add(Me.lblToolbalDescription)

        Me.Controls.Add(Me.Label5)

        Me.Controls.Add(Me.Label4)

        Me.Controls.Add(Me.Label3)

        Me.Controls.Add(Me.Label2)

        Me.Controls.Add(Me.Label1)

        Me.Controls.Add(Me.PictureBox5)

        Me.Controls.Add(Me.PictureBox4)

        Me.Controls.Add(Me.PictureBox1)

        Me.Controls.Add(Me.lblTextHelp)

        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D

        Me.MaximizeBox = False

        Me.MinimizeBox = False

        Me.Name = "frmHelpText"

        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

        Me.Text = "Help - Game Instructions"

        Me.ResumeLayout(False)

 

    End Sub

 

#End Region

 

    Private Sub frmHelpText_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        lblHowToPlay.Text = "- An even number of cards are shown with their faces down." & vbCrLf & vbCrLf _

                           & "- Select two of the cards by clicking on them. The cards will turn 'face up'." & vbCrLf & vbCrLf _

                           & "- If the cards match, those cards will be removed. If the cards differ, they are flipped back" & vbCrLf  _

                           & "  over within a short period of time, and the player will try to remember what is on the card" & vbCrLf _

                           & "  for future tries." & vbCrLf & vbCrLf _

                           & "- The game is over when the user has matched all of the pairs and all the cards are gone."

 

    End Sub

End Class

 

'MSSE Fairfield University

'SW403- Fall 2005

'Guillermo V. Julca

'http://www.gjp2s.com

 

Public Class frmAbout

    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 btnOK As System.Windows.Forms.Button

    Friend WithEvents lblCopyRight As System.Windows.Forms.Label

    Friend WithEvents lblWarning As System.Windows.Forms.Label

    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox

    Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox

    Friend WithEvents Label1 As System.Windows.Forms.Label

    Friend WithEvents Label2 As System.Windows.Forms.Label

    Friend WithEvents Label3 As System.Windows.Forms.Label

    Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmAbout))

        Me.btnOK = New System.Windows.Forms.Button

        Me.lblCopyRight = New System.Windows.Forms.Label

        Me.lblWarning = New System.Windows.Forms.Label

        Me.PictureBox1 = New System.Windows.Forms.PictureBox

        Me.PictureBox2 = New System.Windows.Forms.PictureBox

        Me.Label1 = New System.Windows.Forms.Label

        Me.Label2 = New System.Windows.Forms.Label

        Me.Label3 = New System.Windows.Forms.Label

        Me.LinkLabel1 = New System.Windows.Forms.LinkLabel

        Me.SuspendLayout()

        '

        'btnOK

        '

        Me.btnOK.Location = New System.Drawing.Point(512, 360)

        Me.btnOK.Name = "btnOK"

        Me.btnOK.Size = New System.Drawing.Size(88, 24)

        Me.btnOK.TabIndex = 0

        Me.btnOK.Text = "OK"

        '

        'lblCopyRight

        '

        Me.lblCopyRight.Location = New System.Drawing.Point(144, 24)

        Me.lblCopyRight.Name = "lblCopyRight"

        Me.lblCopyRight.Size = New System.Drawing.Size(472, 288)

        Me.lblCopyRight.TabIndex = 3

        '

        'lblWarning

        '

        Me.lblWarning.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D

        Me.lblWarning.Location = New System.Drawing.Point(16, 336)

        Me.lblWarning.Name = "lblWarning"

        Me.lblWarning.Size = New System.Drawing.Size(480, 88)

        Me.lblWarning.TabIndex = 4

        Me.lblWarning.Text = "Warning: This program is protected by all applicable copyright laws.  It is illeg" & _

        "al to reverse engineer or otherwise use the contents of this program  or other f" & _

        "iles used by this program without the express written permission from GJ."

        '

        'PictureBox1

        '

        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)

        Me.PictureBox1.Location = New System.Drawing.Point(16, 16)

        Me.PictureBox1.Name = "PictureBox1"

        Me.PictureBox1.Size = New System.Drawing.Size(104, 96)

        Me.PictureBox1.TabIndex = 5

        Me.PictureBox1.TabStop = False

        '

        'PictureBox2

        '

        Me.PictureBox2.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))

        Me.PictureBox2.Location = New System.Drawing.Point(16, 112)

        Me.PictureBox2.Name = "PictureBox2"

        Me.PictureBox2.Size = New System.Drawing.Size(104, 200)

        Me.PictureBox2.TabIndex = 6

        Me.PictureBox2.TabStop = False

        '

        'Label1

        '

        Me.Label1.Font = New System.Drawing.Font("Times New Roman", 16.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label1.ForeColor = System.Drawing.Color.Black

        Me.Label1.Location = New System.Drawing.Point(160, 16)

        Me.Label1.Name = "Label1"

        Me.Label1.Size = New System.Drawing.Size(432, 40)

        Me.Label1.TabIndex = 7

        Me.Label1.Text = "GJ Memory Game Cards"

        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        '

        'Label2

        '

        Me.Label2.Font = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label2.Location = New System.Drawing.Point(168, 48)

        Me.Label2.Name = "Label2"

        Me.Label2.Size = New System.Drawing.Size(424, 32)

        Me.Label2.TabIndex = 8

        Me.Label2.Text = "Software Program Version 1.0.0"

        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        '

        'Label3

        '

        Me.Label3.Font = New System.Drawing.Font("Times New Roman", 11.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label3.Location = New System.Drawing.Point(144, 144)

        Me.Label3.Name = "Label3"

        Me.Label3.Size = New System.Drawing.Size(464, 24)

        Me.Label3.TabIndex = 9

        Me.Label3.Text = "Copyright (c) 2005-2006      All Rights Reserved."

        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        '

        'LinkLabel1

        '

        Me.LinkLabel1.Location = New System.Drawing.Point(24, 392)

        Me.LinkLabel1.Name = "LinkLabel1"

        Me.LinkLabel1.Size = New System.Drawing.Size(160, 16)

        Me.LinkLabel1.TabIndex = 10

        Me.LinkLabel1.TabStop = True

        Me.LinkLabel1.Text = "http://www.gjp2s.com"

        '

        'frmAbout

        '

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

        Me.ClientSize = New System.Drawing.Size(640, 474)

        Me.Controls.Add(Me.LinkLabel1)

        Me.Controls.Add(Me.Label3)

        Me.Controls.Add(Me.Label2)

        Me.Controls.Add(Me.Label1)

        Me.Controls.Add(Me.PictureBox2)

        Me.Controls.Add(Me.PictureBox1)

        Me.Controls.Add(Me.lblWarning)

        Me.Controls.Add(Me.lblCopyRight)

        Me.Controls.Add(Me.btnOK)

        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D

        Me.MaximizeBox = False

        Me.MinimizeBox = False

        Me.Name = "frmAbout"

        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

        Me.Text = "About GJ Memory Game Cards"

        Me.ResumeLayout(False)

 

    End Sub

 

#End Region

 

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click

        Me.Close()

    End Sub

 

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked

        Dim p As New ProcessStartInfo

        p.FileName = "http://www.gjp2s.com"

        p.UseShellExecute = True

        Process.Start(p)

    End Sub

End Class

 

 

Go to Home Page

 

View Output