C # Game-Assisted Scripting tutorial--listbox controls

Source: Internet
Author: User

C # Game-Assisted Scripting Learning record (September 3, 2017)

Use ideas

Use the ListBox control to display all my tasks and the tasks I have selected.

Left is listbox_ selected task , right is listbox_ task List

Double-click Add content to another ListBox list (from task List → selected task)

Using the double-click event in the ListBox, there are 2 double-click events, DoubleClick and MouseDoubleClick

I do not know what is the difference, try to feel the same operation, temporarily first use DoubleClick

Private voidListbox_ Task List _doubleclick (Objectsender, EventArgs e) {    intindex =listbox_ Task List.    SelectedIndex; Console.WriteLine ("The current selection is the first"+ Index. ToString () +"Items"); stringvalue; Value=listbox_ Task List. Items[index].    ToString (); Console.WriteLine ("the selection is as follows:"+value); Listbox_ selected tasks. Items.Add (value);}
Gets how many items are in the listbox

Function: Traverse all item Contents

int Shu;shu = listbox_ selected task. Items.Count;
Iterate through the contents of all items in a ListBox

Role: According to each of the obtained content to carry out the corresponding task, to achieve the free combination of tasks.

int Shu; string  = listbox_ selected task. Items.Count; Console.WriteLine ("   a total of " "Tasks");  for (int0; i < Shu; i++) {    = listbox_ selected task. Items[i]. ToString ();    Console.WriteLine (value);}

C # Game-Assisted Scripting tutorial--listbox controls

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.