WinForm Program Development

Source: Internet
Author: User

WinForm Program Development
------------------------------Main Page----------------------------------
BaseForm.cs base class, for deriving child windows

Login.cs Login for Login window

MainForm.cs home page, System home page

LoginOut.cs logoff for log-in logoff window

Page folder, other directory where startups are located

------------------------------Entrance Procedure----------------------------------

Static Class Program
{
public static Form mainform = null;
<summary>
The main entry point for the application.
</summary>
[STAThread]
static void Main ()
{
Application.enablevisualstyles ();
Application.setcompatibletextrenderingdefault (FALSE);
Application.Run (New Login ());

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

------------------------------------------------------------------
Page Jump
Instantiate the main screen
Program.mainform = new MainForm ();
Close the login screen
This. Close ();

---------------------------Create a base class---------------------------------------

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
}
}
---------------------------the WebBrowser control---------------------------------------
1. Call URL
THIS.WEBBROWSER1.URL = new System.Uri ("http://127.0.0.1", System.UriKind.Absolute);

2. Disable Right-click
this.webBrowser1.IsWebBrowserContextMenuEnabled = false;

---------------------------the DockPanel control to display the page---------------------------------------

Subpage sp = new subpage (); Child page

DockPanel Display subpage page
This.dpmain the name of the control for DockPanel
This.sp.Show (This.dpmain, WeifenLuo.WinFormsUI.Docking.DockState.Document);



---------------------------Click to pop up the new page---------------------------------------
private void Menu_click (object sender, EventArgs e) {
Subpage sp = new subpage ();
Sp.    ShowDialog (); Pop up a new page
}





WinForm Program Development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.