FaceGame_10  application, developed with Visual Basic  2010
 
 
     
     
 
   
Return
1  Software use: Microsoft Visual Studio 2010 Professional  
2 The Microsoft Visual Basic 2010  member of the Microsoft Visual Studio 2010 Professional  
     

      
       
    FaceGame_10 application ..., describe how to use Microsoft Visual Basic 2010 to create game application
             
 


 
 

   
1  General info
2  Create new Visual Basic 2010 project - FaceGame_10
3  Create Visual Basic Form, FaceGame.vb
4  Create Visual Basic Form, DemoForm.vb
5  Create Visual Basic Form, AboutForm.vb
6  Create Visual Basic - Module1.vb
   


 

 1- General info



The Classes used in this application
         

 System.Console, System.Drawing, System.Resources, ImageList, Label,  MainMenu, Panel,  PictureBox,  Timer,  ToolBar
   
 

 Info ...
  1. Name - FaceGame_10
  2. Game  Software.
  3. Developed with Microsoft Visual Basic 2010.
     
  4. Functions ...
    1. Arrange boxes using the mouse
    2. Demo Game

     

  5. Requirements: Microsoft Visual Studio 2010 Professionnal.
     
    If you want to run it:
    1. Remove the read-only attribute of all files in the folder - C:\VBN_FGame_10
    2. Run the Microsoft Visual Studio 2010 Professional.
    3. From File menu, choose Open  then choose Project/Solution,  the Open Project dialog box appears,  select the FaceGame_10 project file -Type: Microsoft Visual Studio Solution (C:\FaceGame_10\FaceGame_10.sln) and then click Open.
    4. From Debug menu, choose and click Start Debugging.


        Project - FaceGame_10 and those items
 

 

 
 
 2- Create new Visual Basic 2010 project - FaceGame_10
 
a. Create new Visual Basic 2010 project - FaceGame_10, The steps to create ...
 
  Run Microsoft Visual Studio 2010 Professional.
      On the File menu , click New, and then click Project .... The New Project dialog box appears.
      
  1. In the installed Templates pane, select the Visual Basic
  2. and then Select Windows Forms Application icon.
    A message appears: Type: Visual Basic.
                                        A project for creating an application with a Windows user interface.
  3. In the Name box, type FaceGame_10
  4. In the Location box, type C:\
  5. Click OK.

The Windows Application create all necessary files and opens the  Visual Basic 2010 project - FaceGame_10.
 
System Create Automaticaly Empty Form - Form1.vb.The codes file, created ...

Public Class Form1

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

End Sub

End Class

 

 

Rename the created Form - Form1.vb

 

  • On the View menu , click  Solution Explorer
  • In Solution Explorer, expand the FaceGame_10 project node  and select Form1.vb
  • In Properties windows, Type the new File Name = FaceGame.vb
     
 
 
 3- Create Visual Basic Form, FaceGame.vb
 
  a- the Form Design

The View design..


From the Toolbox\windows Form addthe following controls
     One
 ImageList control, thirty eight  Label controls , one  MainMenu  controls, twele Panel  controls,  tree PictureBox  controlsone ToolBar  controls and four Timer controls.

The Functions ...
         Arrange boxes using the mouse
 

 
  b- the Form Code, To Continue Click ---> The Codes ..
 
 Note   -   random numbers order :
        
               in Visual Basic 2010, the random number generator  used
                1- Rnd()  function - returns a value less than 1, but greater than or equal to zero.
                2- Dim vrnd as Integer
               3- vrnd = Int(9 * Rnd()) + 1

 
 
  c- After running, the following designs display by order
 
 

    

 
After running, the following designs display by order
 

 

 
 
 4- Create Visual Basic Form, DemoForm.vb
 
a.  DemoForm design

This Form displays when you select the Zoom button ( zoom+ )  from  PictureForm.vb

  
   The Form
 design.
 

 
The View  design.
 



 From the Toolbox\windows Form addthe following controls

           One button control, forty six Label controls, teen Panel controls, one  PictureBox control and two Panel controls.

  The Functions ...
       Show how this Game work .

 

   
b.   DemoForm, the Godes
   
 
  DemoForm, the Codes
   
 
 
 5- Create Visual Basic Form, AboutForm.vb
 
 a- AboutForm, Design

   This Form displays, when you select  the Toolbar Button About from  FaceGameNet.vb.
 


  This Form includes the following  controls:
      Tree  PictureBox control, seven Label controls, one Button control and one Timer control.

   Click the Button Done,  the current Form unload

 b- AboutForm, The Codes ...
 

Public Class AboutForm

Inherits System.Windows.Forms.Form

Dim IcoNmbr As Integer

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

 

IcoNmbr = 0

Me.Timer1.Enabled = True

End Sub

Private Sub btnDone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndone.Click

' To close the current form

Me.Close()

FFaceGameNet.New_Game()

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If IcoNmbr = 0 Then

Me.picico.Image = Me.picicoOrg0.Image()

IcoNmbr = 1

Else

Me.picico.Image = Me.picicoOrg1.Image()

IcoNmbr = 0

End If

End Sub

Private Sub AboutForm_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed

FFaceGameNet.New_Game()

End Sub

End Class

 
 
 6- Create Module - Module1.vb
 
  1- Module - Module1.vb
 
  • On the Project menu , click  Add New Item ..., The Add New Project - FaceGame_10 dialog box appears :.
  • In this  Add New Item - FaceGame_10 dialog box:
  • Select Module icon.
    A message appears: Type: Common Items.
                                        A file for storing groups of functions
  • In the Name box, type Module1.vb
  • Click Add
  • The Module1.vb code stores information about all public variables used in this application.


    2- Module, The  codes ...
     

    Module Module1

    Public FFaceGameNet As New FaceGame

    Public Sub Main()

    ' Starts this application

    FFaceGameNet = New FaceGame

    Application.Run(FFaceGameNet)

    End Sub

    End Module

     

    b- Set new Startup object - Sub Main
     
     
    • On the Project menu , click  FaceGame_10 Properties ..., the FaceGame_10 Property Pages dialog box appears
    • In the Startup form combo box, choose and  select FaceGame
    • In the Icon combo box, choose and  select pic\Face.ico