1. Form and interface design-navigation menu interface

Source: Internet
Author: User

For some application tool software, the interface should not only be user-friendly, beautiful, but also highlight the interface functions and ease of use, in order to attract users.

014 OutLook Interface

Generally, the menu bar and toolbar of a program cannot be moved, but you only need to set the AllowItem Recorder attribute of the MenuStrip and ToolStrip controls to True.

: When you move the menu bar and toolbar, press and hold the "Alt" key and drag it with the mouse.

1. create a project. The default form is Form1. Add the MenuStrip control to the Form1 form to design the main menu. Add the ToolStrip control to design the toolbar. Add the StatusStrip control to design the status bar; add the ImageList control and TreeView control to design the tree structure.

2. add sub-items for the MenuStrip control, ToolStrip control, ImageList empty control, and TreeView control, and set the AllowItemRecorder attribute of the MenuStrip control and ToolStrip control to True, set the DisplayStyle attribute of each subitem of the ToolStrip control to "ImageAndText ".

This example mainly uses the Button control and ListView control to create the navigation menu interface. When adding menu information to the ListView control, you must write the Add statement in front, such as ListView. Items. Add. Otherwise, the added menu information replaces the previous one. When you click the corresponding button, the ListView control should be cleared first. Otherwise, the previous menu addition information will continue in the ListView control.

 

1. create a project. The default form is Form1. Add the MenuStrip control design main menu to the Form1 form. Add the ToolStrip control design toolbar; the SplitContainer control, ImageList control, three Button controls, and ListView controls are added to create the left-side navigation bar.

2. Add sub-items for the MenuStrip control and ToolStrip control respectively, and add the three Button controls and ListView controls to the left part of SplitContainer1.panel.

Namespace _ 015_Navigation {public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void Form1_Load (object sender, EventArgs e) {listView1.Clear (); // clear the original content listView1.LargeImageList = imageList1 in ListView1; // set the image listView1.Items used to display the current item in the form of a large icon. add ("set commuting time", "set commuting time", 0); listView1.Items. add ("whether to enable SMS reminder", "Whether to enable short-term reminder", 1); listView1.Items. add ("set password", "set password", 2);} private void button2_Click (object sender, EventArgs e) {listView1.Dock = DockStyle. none; // set the binding attribute of LIstView1 to not bound button2.Dock = DockStyle. top; // set the binding attribute of button2 to the upper bound button1.SendToBack (); // send the control button1 to the end of the Z sequence, button1.Dock = DockStyle. top; // set the binding attribute of button1 to the upper bound button3.Dock = DockStyle. bottom; // set the binding attribute of button3 to listView1.Dock = DockStyle at the Bottom. bottom; // set the binding attribute of LIstView1 to listView1.Clear () at the Bottom; // clear the original content of listView1.Items in listview1. add ("Recent work records", "Recent work records", 3); listView1.Items. add ("Recent Work Plan", "Recent Work Plan", 4);} private void button3_Click (object sender, EventArgs e) {listView1.Dock = DockStyle. none; // set the binding property of LIstView1 to not bound button3.SendToBack (); // send the control button3 to the end of the Z sequence button3.Dock = DockStyle. top; // set the binding attribute of button3 to the upper bound button2.SendToBack (); // send the control button2 to the end of the Z sequence, button2.Dock = DockStyle. top; // set the binding attribute of button2 to the upper bound button1.SendToBack (); // send the control button1 to the end of the Z sequence, button1.Dock = DockStyle. top; // set the binding attribute of button1 to the upper bound listView1.Dock = DockStyle. bottom; // set the binding attribute of LIstView1 to listView1.Clear () at the Bottom; // clear the original content of listView1.Items in listview1. add ("Edit Work Progress Report", "Edit Work Progress Report", 5); listView1.Items. add ("Edit Project Design Drawing", "Edit Project Design Drawing", 6);} private void button#click (object sender, EventArgs e) {listView1.Dock = DockStyle. none; // set the binding attribute of LIstView1 to not bound button1.Dock = DockStyle. top; // set the binding attribute of button1 to the upper bound button2.Dock = DockStyle. bottom; // set the binding attribute of button2 to bind button3.SendToBack () at the Bottom; // send the control button3 to the end of the Z sequence, button3.Dock = DockStyle. bottom; // set the binding attribute of button3 to listView1.BringToFront () at the Bottom; // bring listview1 to the front of the Z sequence listView1.Dock = DockStyle. bottom; // set the binding attribute of LIstView1 to listView1.Clear () at the Bottom; // clear the original content of listView1.Items in listview1. add ("set commuting time", "set commuting time", 0); listView1.Items. add ("enable SMS reminder", "enable SMS reminder", 1); listView1.Items. add ("set password", "set password", 2 );}}}

016 graphical navigation interface

This example mainly sets the corresponding properties of the Button control to determine the Button position, text, display style, and image to be displayed.

1. Create a project. The default form is Form1. Add the MenuStrip control design main menu to the Form1 form, add the ToolStrip control design toolbar, and add the Panel control and Button control to design graphical navigation buttons.

2. Add sub-items for the MenuStrip control and ToolStrip control respectively, and select the background image for the Panel control.

3. Set the BackColor attribute of the Button control to "Transparent", the FlatStyle attribute to "Flat", and the TextImageRelation attribute to "ImageBeforeText ".

namespace _016_ButtonNavigation{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void button1_Click(object sender, EventArgs e)        {            button5.Visible = true;            button6.Visible = true;            button7.Visible = true;        }        private void button2_Click(object sender, EventArgs e)        {            button8.Visible = true;            button9.Visible = true;            button10.Visible = true;        }        private void button3_Click(object sender, EventArgs e)        {            button11.Visible = true;            button12.Visible = true;            button13.Visible = true;        }    }}

Related Article

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.