"2017-04-27" layout and container controls, open multiple forms, constructor pass values, open unique window

Source: Internet
Author: User

First, layout and container controls

1. Layout properties

-Anchor control positioning lock dead in that position, according to which location locked dead.

-Dork fill, fill up and down around.

-Location.

2. Container controls

-The Panel is equivalent to a div in HTML.

-FlowLayoutPanel inherited from panel, multi-flow layout function

-GroupBox inherited from panel, one more title, with small dashed lines.

-TabControl Tab

tab to modify the caption, use the TAB's TabPages property to modify the content to be displayed in the Text property corresponding to each tab caption.

-SplitContainer split Panel

Properties for horizontal split vertical split: Orientation

-Tablyoutpanel table, a cell can be placed only one control.

Implementing a multi-control: Place a container in a cell that fills the cell and puts multiple controls in the container.

Second, open multi-form

Instantiate a FORM2 in the Click event.

Problems encountered:

1, the Landing Screen main window close will be opened after the window is also closed.

To resolve this problem, hide the login interface of the main window after logging in, instead of shutting it down.

2, through the open window to exit the program.

In the FormClosing event of the open window, use the constructor to pass the value to close the object you want to close.

The change of the constructor will be error in the place where the constructor is instantiated, and be aware of the changes.

Increase the scope of the F1, and then call the Close method in the event.

Cross-form transfer value (constructor pass value)

The value is passed through the constructor function.

The change of the constructor will be error in the place where the constructor is instantiated, and be aware of the changes.

Iv. opening a unique form

Create a collection of forms

List<form> formlist=new list<form> ();

Each open Form object is placed in this collection

Each time you open the form, go to the collection to determine whether the form has been opened.

1    //create a collection of forms2List<form> formlist =NewList<form>();3 4         Private voidButton1_Click (Objectsender, EventArgs e)5         {6             BOOLhas =false;7             //function Passing Value8Form3 F3 =NewFORM3 ( This);9             //traverse the formlist to see if there are any forms to openTen             foreach(Form Finchformlist) One             { A                 if(f isForm3) -                 { -has =true; theF3 = f asForm3; -                 } -             } -             //if it's been opened, +             if(HAS) -             { +                 //from minimized to normal state, and focus enters AF3. WindowState =Formwindowstate.normal; at F3. Focus (); -             } -             //If you have not been opened, place the form in the form collection and then open it.  -             Else -             { - Formlist.add (F3); in F3. Show (); -             } to         } +  -  the         //Delete the corresponding subform object in the collection of the parent form *          Public voidDeleteform (Form f) $         {Panax Notoginseng Formlist.remove (f); -}

When you close a subform, you can reopen the new subform by deleting the corresponding subform object in the parent form's collection

"2017-04-27" layout and container controls, open multiple forms, constructor pass values, open unique window

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.