The program entry point is very similar to common .NET programs. The following code can be used to launch the main form.
程序入口点与普通.NET程序非常类似。可以用下面的代码来启动主窗体。

    static void Main()
    {
        Application.Run(new MainForm());
    }

Then create a form by inheriting from Form class.
然后通过继承Form类来创建这个窗体。

    class MainForm : Form
    {
        ToolBar toolbar = new ToolBar();
        Button basicControlButton = new Button();
        public MainWindow()
        {
            Text = "MainWindow";
            toolbar.SetButton(ToolBar.ButtonIndex.TOOLBARPRO_LEFT_TEXTBUTTON, true, true, "退出");
            toolbar.ButtonClick += new EventHandler<ToolBar.ButtonEventArgs>(toolbar_ButtonClick);
            Controls.Add(toolbar);
            basicControlButton.Text = "基本控件";
            basicControlButton.Location = new Point(10, 10);
            basicControlButton.Click += new EventHandler(basicControlButton_Click);
            Controls.Add(basicControlButton);
        }
        void toolbar_ButtonClick(object sender, ToolBar.ButtonEventArgs e)
        {
             Application.Exit();
        }
        void listControlButton_Click(object sender, EventArgs e)
        {
            MessageBox.Show("测试");
        }
    }

Last edited Apr 30, 2010 at 4:20 PM by LutherSun, version 2

Comments

No comments yet.