Created
August 11, 2017 09:58
-
-
Save jskeet/57d2ff6660c8b3526c2de8f2d99b3b72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Drawing; | |
using System.Windows.Forms; | |
public class Test | |
{ | |
static void Main() | |
{ | |
Button button = new Button | |
{ | |
Text = "Click", | |
Location = new Point(10, 50) | |
}; | |
ListBox list = new ListBox | |
{ | |
Items = { "first", "second", "third" }, | |
Location = new Point(10, 100), | |
SelectionMode = SelectionMode.MultiExtended | |
}; | |
button.Click += delegate | |
{ | |
Console.WriteLine("Selected items:"); | |
foreach (var item in list.SelectedItems) | |
{ | |
Console.WriteLine(item); | |
} | |
}; | |
Form form = new Form | |
{ | |
Size = new Size(300, 300), | |
Controls = { button, list } | |
}; | |
Application.Run(form); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment