日期:2014-05-18 浏览次数:22748 次
// Form1.cs
// compile with csc /t:winexe Form1.cs
using System;
using System.Drawing;
using System.Windows.Forms;
public class Form1 : Form
{
    public Form1()
    {
        CheckBox checkBox1 = new CheckBox();
        Button button1 = new Button();
        checkBox1.Text = "cancel";
        checkBox1.Location = new Point(60, 80);
        checkBox1.Appearance = Appearance.Button;               //<-------
        checkBox1.CheckState = CheckState.Checked;
        checkBox1.Size = new Size(80, 25);
        checkBox1.TextAlign = ContentAlignment.MiddleCenter;
        
        button1.Text = "ok";
        button1.Location = new Point(60,120);
        button1.Size = checkBox1.Size;
        this.Controls.Add(checkBox1);
        this.Controls.Add(button1);
    }
    static void Main()
    {
        Application.Run(new Form1());
    }
}