当前位置:编程学习 > C#/ASP.NET >>

Mono问题之一——中文支持

答案:我写了一些代码如下:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Sample
{
public class FormX : System.Windows.Forms.Form
{

private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button btn = null;
public FormX()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "路亦平";

this.btn = new System.Windows.Forms.Button();
this.btn.Location = new System.Drawing.Point(100, 100);
this.btn.Name = "btn";
this.btn.Size = new System.Drawing.Size(56, 24);
this.btn.TabIndex = 6;
this.btn.Text = "确定";
this.Controls.Add(this.btn);
this.btn.Click += new System.EventHandler(this.btn_Click);
}

private void btn_Click(object sender, System.EventArgs e)
{
MessageBox.Show("中文");
this.Close();
}
[STAThread]
static void Main()
{
Application.Run(new FormX());
}
}
}



用mcs -r:System.Windows.Forms -r:System.Drawing -r:System.Data hello.cs对这个文件进行编译后产生一个可执行文件,执行它,可以看到如下界面:

上一个:十个必备的.NET开发小工具(8):NAnt
下一个:关于DIB的输出方式

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,