码迷,mamicode.com
首页 > Windows程序 > 详细

WinForm程序开发

时间:2015-06-04 11:25:22      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

WinForm程序开发
------------------------------主要页面----------------------------------
BaseForm.cs    基类,用于派生子窗口
    
Login.cs    登录,用于登录窗口

MainForm.cs    主页,系统主页

LoginOut.cs    注销,用于登录注销窗口

Page        文件夹,其他创业所在的目录

------------------------------入口程序----------------------------------

static class Program
    {
        public static Form mainForm = null;
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Login());

            if (mainForm != null)
            {
                Application.Run(mainForm);
            }
        }
}

------------------------------------------------------------------
页面跳转
//实例化主画面
Program.mainForm = new MainForm();
//关闭登录画面
this.Close();

---------------------------创建基类---------------------------------------

namespace BiogasProjectClient.Page
{
    partial class BaseForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.SuspendLayout();
            //
            // BaseForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(702, 337);
            this.Name = "BaseForm";
            this.ResumeLayout(false);

        }

        #endregion
    }
}
---------------------------webBrowser控件---------------------------------------
1.调用网址
this.webBrowser1.Url = new System.Uri("http://127.0.0.1", System.UriKind.Absolute);

2.禁止右键
this.webBrowser1.IsWebBrowserContextMenuEnabled = false;

---------------------------DockPanel控件显示页面---------------------------------------

SubPage sp = new SubPage();        //子页

//DockPanel显示SubPage页面
//this.dpMain为DockPanel的控件名称
this.sp.Show(this.dpMain, WeifenLuo.WinFormsUI.Docking.DockState.Document);    



---------------------------点击弹出新页面---------------------------------------
private void menu_Click(object sender, EventArgs e){
    SubPage sp = new SubPage();
        sp.ShowDialog();    //弹出新页面
}





WinForm程序开发

标签:

原文地址:http://www.cnblogs.com/sntetwt/p/4551093.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!