This is "using C # To develop smartphone software: Push box" Series Article 12th. This article introduces the window/aboutdlg. Cs SOURCE Program File. This source file contains the aboutdlg class, which inherits from the system. Windows. Forms. Form class, indicating the "about" dialog box for pushing the box. As shown in:
The following is the source program of window/aboutdlg. Designer. CS.Code:
Namespace Skyiv. Ben. pushbox. Window
{
Partial Class Aboutdlg
{
// Some code is omitted here
Private System. Windows. Forms. tabcontrol tclmain;
Private System. Windows. Forms. tabpage tpgversion;
Private System. Windows. Forms. tabpage tpgsystem;
Private System. Windows. Forms. textbox tbxversion;
Private System. Windows. Forms. textbox tbxsystem;
}
}
In the "about" dialog box, you can use a tabcontrol control to manage the relevant tab pages, which are divided into two tabs: "version" and "system" (tabpage control ), the Textbox Control is used in each tab to display related information. The following is the source code of window/aboutdlg. CS:
1 Using System;
2 Using System. Windows. forms;
3 Using Skyiv. Ben. pushbox. Common;
4
5 Namespace Skyiv. Ben. pushbox. Window
6 {
7 /**/ /// <Summary>
8///"About" dialog box
9/// </Summary>
10 Public Partial Class Aboutdlg: Form
11 {
12 Public Aboutdlg ( Bool Istopmost)
13 {
14Initializecomponent ();
15Topmost=Istopmost;
16}
17
18 Protected Override Void Onload (eventargs E)
19 {
20Base. Onload (E );
21Loadversioninfo ();
22Loadsysteminfo ();
23}
24
25 Protected Override Void Onresize (eventargs E)
26 {
27Base. Onresize (E );
28Loadsysteminfo ();
29}
30
31 Void Loadversioninfo ()
32 {
33 Tbxversion. Text = " Skyiv (r) Push box " + FCL. newline +
34 " Version " + Pub. getversionbuildstring (Pub. Version) + FCL. newline + FCL. newline +
35 " (C) skyiv Studio (Ben) " + FCL. newline +
36 " Http://ben.skyiv.com " + FCL. newline +
37 " Skyivben@gmail.com " + FCL. newline + FCL. newline +
38 " The push box is a green software developed using C # based on Microsoft. NET Compact Framework 2.0. " +
39 " The operating environment is a Microsoft Windows Mobile 6.0 smartphone. " +
40 " Microsoft. NET Framework 2.0 runs on the computer of the Runtime Library. " ;
41 }
42
43 Void Loadsysteminfo ()
44 {
45 Tbxsystem. Text = " Operating System ID: " + Environment. osversion. Platform + FCL. newline +
46 " Operating system version: " + Environment. osversion + FCL. newline +
47 " Public Language Runtime Library version: " + Environment. Version + FCL. newline +
48 " Screen Resolution: " + Pub. tostring (screen. primaryscreen. bounds. Size) + FCL. newline +
49 " Program location: " + Pub. codebases;
50 }
51 }
52 }
The constructor of the aboutdlg class (and classes that represent various dialogs in the window directory) has a Boolean parameter istopmost, which indicates whether "menu-> front-end display" is selected, that is, whether it is always displayed at the beginning. In addition, the aboutdlg class also reloads the onresize method of the base class. When the size of the window in the "about" dialog box changes, call the loadsysteminfo method to update the "System" information, it is used to display the correct "Screen Resolution" when the smartphone switches between the "Landscape" and "Landscape ".
In addition, the smartphone does not support the tabcontrol control, so the "about" dialog box of the push Box program of the smartphone version directly places a Textbox Control on the form to display information.
Previous Article: Using C # To develop smartphone software: Push box (11)
Next article: use C # To develop the smartphone software: Push box (13th)
Returned directory