Windows Form Application (C#) : Create Form (My first Form)
Window forms has program's type the same as Windows. In past, users used Command line (CMD)
to work or control a lot of programs.In my point of view, Command line is hard to use for user.
At the present time,windows forms can help users work in simple way of Programs/Applications because the format of windows forms the same as windows type.
At the present time,windows forms can help users work in simple way of Programs/Applications because the format of windows forms the same as windows type.
There are materials of windows forms as follow : Component , Properties , Events , Methods.
[Thai Sub] : เกริ่น! Window forms มีลักษณะของโปรแกรมเช่นเดียวกับหน้าต่าง แต่ก่อนคนใช้โปรแกรมใช้ Command line (CMD) หนาต่างจอดำๆ แต่่ตอนนี้ตัว Window forms ช่วยให้ผู้ใช้ใช้งานโปรแกรมได้ง่ายขึ้น
ส่วนประกอบของ windows form : Component , Properties , Events , Methods
How to create form ?
First of all, open Microsoft Visual Studio icon in your computer.
Step 1 : create new project / click File ->New -> Project.. (Figure 1) /
[Thai Sub] Step 1 : สร้าง project / click File ->New -> Project.. (Figure 1) /
(Figure 1 : create new project )
Step 2 : create new project
/ Template -> Visual C# -> Choose "Windows Forms Application" / (Figure 2)Developer can select comfortable version of .NET for programs/application.
In this topic , I select .NET Framework 4.5.2 . Next,you must fill in project name in Name , Solution and click OK.
According to Solution , one thing is important for creating new project that is "Solution (.sln)".
Visual studio always builds "Solution (.sln)" when you create new project. Solution can control or organize all of structures in project.
Carefully! don't remove Solution (.sln)
[Thai Sub] : ในการเขียน Wndows Forms C# ตอนสร้างโปรเจคใหม่ คนเขียนควรจะเลือก version ของ .NET กับความต้องการของโปรแกรมให้เหมาะสม
อีกสิ่งหนึ่งที่สำคัญในการสร้างโปรเจคคือ Solution แต่ละโปรเจคที่สร้างจะมี solution file (.sln) มาให้เสมอ ซึ่งตัวนี้ จะเอาไว้กำหนดโครงสร้างและไฟล์ต่างๆของโปรเจค จริงๆ ตอนเรียน APD เคยหลงลบ(.sln)ออกครั้งหนึ่งแล้ว มันยุ่งยากในการสร้างโปรเจคใหม่ แล้ว import ไฟล์ต่างๆเข้า เปลืองเวลาเราไง ถูกป่ะ !! #ทีมขี้เกียจ จริงๆ ชื่อโปรเจค กับ ชื่อ Solution name นี้ตั้งชื่อต่างกันได้น่ะ ลองดู!!
สร้าง Forms นี้ง่ายมาก กด OK ก็ได้ ฟอร์มล่ะ บทความนี้เขียนเท่านี้ล่ะ
(Figure 2 : create new project)
Step 3 : Completed, First Windows Forms show in Visual studio.
(Figure 2 : First Windows Forms)
Step 4 : Look at "Solution Explorer". There are core sections in solution explorer follow as : Solution , Form , Properties , Reference , App.config , Form1.cs , Program.cs .
- Solution : control or organize all of structures in project.
- Form : show project name.
- Properties : set or manage all of Windows Forms
- Reference : Reference or using with another class , function , operator
- Form1.cs : This file can edit class of form or component.
- Program.cs : Windows forms has a file (Program.cs) can set current file name of Forms .





ไม่มีความคิดเห็น:
แสดงความคิดเห็น