First, WPF application
WPF uses XAML (Extensible Application Markup Language) to extend the Application Markup Language for page manipulation, which is easy to understand.
The following piece of code is the layout of the page using the XAML language
<window x:class= "Wpfapplication1.window1"
Xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"
Title= "Window1" height= "width=" >
<grid width= "height=" >
<Grid.RowDefinitions>
<rowdefinition height= "/>"
<rowdefinition height= "*"/>
</Grid.RowDefinitions>
<stackpanel >
<textblock text= "Top stack Panel" verticalalignment= "Center"/>
</StackPanel>
<stackpanel >
<textblock text= "Bottom stack Panel" verticalalignment= "Center"/>
</StackPanel>
</Grid>
</Window>
The interface is as follows:
Second, Windows Form applications
In fact, the development of WPF and Windows Form application is very similar to the development of Windows Phone, and it is all about dragging and dropping controls, editing, and reacting to the actions of controls.
Here is an example of a Windows Form applications
UI Design:
The code inside the Form1 is as follows:
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespacewindowsformsapplication2{ Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); } Private voidButton1_Click (Objectsender, EventArgs e) { stringA =TextBox1.Text; stringb =TextBox2.Text; if(A = ="Qwer"&& b = ="123456") {MessageBox.Show ("Landing Success"); } Else{MessageBox.Show ("Login Failed"); TextBox2.Text=" "; } } Private voidButton2_Click (Objectsender, EventArgs e) {TextBox2.Text=" "; TextBox1.Text=" "; } }}
The results are as follows: Login failed:
Login success:
Personally, the development of this kind of application is to learn from the example of the use of a variety of controls, so I cite two examples, the use of the control is much the same, and many of the use of the control need to learn from the actual.
C # Learning notes for WPF application and Windows Form applications