WinForm Menu firing Form switching practices

Source: Internet
Author: User

Often use similar to the WinForm form, where click on the menu when the Netural do the content form switch, today also record the method of switching

Place a panal in the main form, and all the content forms are rendered on panal, implementing the following methods

Instantiating the main form

private void Frmsetup_load (object sender, EventArgs e)
{
This.btnsystem_click (null, NULL);
}

Initialize the content form

Public Frmsetup (UINT UIDEVICESN)
: This ()
{
M_UIDEVICESN = UIDEVICESN;
M_devsetuprefobj = new Devsetuprefobj (M_UIDEVICESN);
String sinipath = this.m_uiDeviceSN.ToString ("D08") + "\\Setup\\Setup.ini";
if (file.exists (Sinipath))
{
M_devsetuprefobj.loadlocalsetup (Sinipath);
}
Else
{
M_devsetuprefobj.loaddevicesetup ();
}

M_frmbasesyssetup = new Frmbasesystemsetup (M_UIDEVICESN, m_devsetuprefobj);
M_frmeditsetup = new Frmeditsetup (M_UIDEVICESN, m_devsetuprefobj);
M_frmprintsetup = new Frmprintsetup (M_UIDEVICESN, m_devsetuprefobj);
M_frmusersetup = new Frmusersetup (M_UIDEVICESN, m_devsetuprefobj);
M_frmmoresetup = new Frmmoresetup (M_UIDEVICESN, m_devsetuprefobj);
M_frmregister = new Frmregister (M_UIDEVICESN, m_devsetuprefobj);
}
Instantiating a content form
Frmbasesystemsetup M_frmbasesyssetup;
Frmeditsetup M_frmeditsetup;
Frmprintsetup M_frmprintsetup;
Frmusersetup M_frmusersetup;
Frmmoresetup M_frmmoresetup;
Frmregister M_frmregister;


private void Btnsystem_click (object sender, EventArgs e)
{
This. Showsystem ();
This. Hideedit ();
This. Hideprint ();
This. Hideuser ();
This. Hidemore ();
This. Hideregister ();
}

Form Toggle

private void Showuser ()
{
PnlShow.Controls.Clear ();

M_frmusersetup.toplevel = false;
M_frmusersetup.formborderstyle = System.Windows.Forms.FormBorderStyle.None;
PNLSHOW.CONTROLS.ADD (M_frmusersetup);

This.m_frmUserSetup.ShowForm ();
}

The above is the general idea.

WinForm Menu firing Form switching practices

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.