这是“使用 C# 开发智能手机软件:推箱子”系列文章的第十四篇。在这篇文章中,介绍
Window/ErrorMsgDlg.cs 源程序文件。这个源程序文件包含 ErrorMsgDlg 类,该类继承自 System.Windows.Forms.Form 类,表示推箱子的“错误信息”对话框。如下图所示:


下面是 Window/ErrorMsgDlg.Designer.cs 源程序的部分代码:
namespace Skyiv.Ben.PushBox.Window
{
public partial class ErrorMsgDlg
{
// 这里省略了一些代码 
private System.Windows.Forms.TabControl tclMain;
private System.Windows.Forms.TabPage tpgBase;
private System.Windows.Forms.TabPage tpgAdv;
private System.Windows.Forms.TextBox tbxBase;
private System.Windows.Forms.TextBox tbxAdv;
}
}
在“错误信息”对话框中,用一个 TabControl 控件来管理相关的选项卡页集,分为“简明”和“详细”两个选项卡(TabPage 控件),每个选项卡中使用 TextBox 控件来显示相关的信息。下面是 Window/ErrorMsgDlg.cs 源程序的代码:
1 using System.Windows.Forms;
2
3 namespace Skyiv.Ben.PushBox.Window
4 {
5 /// <summary>
6 /// “错误信息”对话框
7 /// </summary>
8 public partial class ErrorMsgDlg : Form
9 {
10 public string ErrorMsg { set { tbxBase.Text = value; } }
11 public string DebugMsg { set { tbxAdv.Text = value; } }
12
13 public ErrorMsgDlg(bool isTopMost)
14 {
15 InitializeComponent();
16 TopMost = isTopMost;
17 }
18 }
19 }
版权声明:本文为博主http://www.zuiniusn.com原创文章,未经博主允许不得转载。
使用 C# 开发智能手机软件:推箱子(十四)
原文:http://blog.csdn.net/u013948190/article/details/47066461