Microsoft Visual Studio – Buttons – Labels – Simple Build Setup

1. Run Visual Studio

2. File> New project, select ‘C# windows Form Application’ and give it a name.
I name it ‘ButtonsTest’

3. In your hard drive you fill find in the folder ‘ButtonsTest’/ButtonsTest/ here C# files

4. On the right column select Form1.cs, on the left open the toolbox, drag and drop over the Form: – Button
– Label

5. Inside the Form select the Button, on the right column in the Property Window you can change the button property as Text, Font, Color, Image etc…
Under the ‘Design’ section (Progettazione) change (Name) to ‘myButton’.

6. Inside the Form select the Label, on the right> Property> Design> (Name) to ‘myLabel’

7. Double-click the button to create the myButton_Click event handler, and add the following code in Form1.cs


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ButtonsTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        } // end public Form1

        private void myButton_Click(object sender, EventArgs e)
        {
            // change the property Text of myLabel, the name is defined in Properties> Design> (Name)
            this.myLabel.Text = "Text Changed by myButton at: " + DateTime.Now.ToLongTimeString(); // Text Changed by myButton at: 10:40:59
            this.myLabel.ForeColor = Color.FromArgb(255, 0, 0); // Label Forecolor of RED 255, BLUE 0, GREEN 0
        }// end myButton_Click
    }// end class Form1
}// end namespace ButtonsTest

8. Run

How does it work?

On the right column open Program.cs, you will find:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ButtonsTest
{
    static class Program
    {
        /// <summary>
        /// Punto di ingresso principale dell'applicazione.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

A C# console application must contain a Main method, in which control starts and ends. The Main method is where you create objects and execute other methods.

Main method run Form1.cs -> Form1.cs manage the design components of Form1

Build (Compilazione)

If you do not care about sign your program when you publish go to:
1. main top menu> Project> Properties> Signing (Firma)> un-check Sign the ClickOnce manifest

2. On the main top menu select ‘Build’ (Compilazione) or CTRL+MAISC+B

3. Read the console to see where ButtonsTest.exe is loacated.

4. Run from the folder ButtonsTest.exe

By |C# .NET, Microsoft Visual Studio|Commenti disabilitati su Microsoft Visual Studio – Buttons – Labels – Simple Build Setup

Microsoft Visual Studio for Unity

1) Install the latest version of Unity
(https://unity3d.com/), check during the installation process: ‘Microsoft Visual Studio Tools for Unity’

2) Install the latest versione of Visual Studio Community, with C# support enabled
(https://www.visualstudio.com/vs/game-development/#tab-4b0d0be8de5f65564ad)

3) Open Visual Studio> File> New> Project> Game> Install Unity> selezionare ‘Visual Studio Tools for Unity’

DONE!

Open Unity Editor, you will find:
Top Menu> Edit> Preferences>External Tools> External Script Editor> Visual Studio 2015

Select a C# script, open it and Visual Studio will start automatically.

Visual Studio is more solid than Monodevelop.

Inside Visual studio you will have:

– main window with a good autocomplete code tools
– main window with mouse hover description of commands
– main window with locked debug controllers, click in the grey vertical bar to put a debug stop point
– on the bottom an Output console
– on the bottom an Error List and tips about obsolete code
– on the right a pro class/functions visualization tool, check ‘Show All Files’ to see the same content of Unity> Project window

Reference:
– https://www.youtube.com/watch?v=2PVPz8Pnnrw
– https://www.youtube.com/watch?v=TPGp770JyDg

By |C# .NET, Microsoft Visual Studio|Commenti disabilitati su Microsoft Visual Studio for Unity

.NET Framework – Introducion

What is .NET?

.NET is a framework of Microsoft, it has 2 main components:

– CLR Common Language Runtime, the engine to run the application
– .NET libraries of classes

The main features are:

– Memory management, not manual memory allocation needed
– Common Type System
– Extended libraries of classes, ready and easy to use
– Specialized libraries as ASP.NET for the web
– CIL Common Intermediate Language, to exchange routines among diffent languages
– Multiplatform support, Win7-10, Win Phone, Xbox

Last but not least, Unity (C#) and Unreal (C++) game engines join the .NET foundation.

To develop using .NET you need the development environment ‘Visual Studio’

Installation

0. Disable the realtime protection of your antivirus and disable Windows Update

1. Install Visual Studio Community https://www.visualstudio.com/it/downloads/
In the package you will have the development environment and the .NET framework included

The application will be installed at C:\Programmi (x86)\Microsoft Visual Studio 14.0

The most popular tools and languages supported are:

– Visual C++
– Visual F#
– Python
– Microsoft SQL
– Silverlight
– Win 10 SDK
– C#
– HTML/Javascript
– Android Visual C++
– iOS Visual C++
– Android SDK
– Apache Ant
– Java SE
– Node.js
– GitHub

2. Take your time, installation + update can take some hours…

Hello World

1. Run Visual Studio

2. File> New project, select ‘C# windows Form Application’ and give it a name.
I name it ‘WindowsFormsApplication-Test1’

3. On the right column select Program.cs and you will see the code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication_Test1
{
    static class Program
    {
        /// <summary>
        /// Punto di ingresso principale dell'applicazione.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }// END Main()
    }// END class Program
}// END namespace

4. F5 to run the project

References:
https://msdn.microsoft.com/it-it/library/hh425099(v=vs.110).aspx
https://msdn.microsoft.com/it-it/library/k1sx6ed2.aspx

Official Lessons here:
https://msdn.microsoft.com/en-us/library/bb383971(v=vs.90).aspx
https://msdn.microsoft.com/it-it/library/jj153219.aspx

By |C# .NET, Microsoft Visual Studio|Commenti disabilitati su .NET Framework – Introducion