• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ListBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ListBox的典型用法代码示例。如果您正苦于以下问题:C# ListBox类的具体用法?C# ListBox怎么用?C# ListBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListBox类属于命名空间,在下文中一共展示了ListBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InitializeControls

        public override void InitializeControls()
        {
            var lb = new ListBox(new Rectangle(0, 0, 800, 600),
                                 ScreenManager.Content.Load<APNGTexture>(@"images\eagss.png"),
                                 ScreenManager.Content.Load<APNGTexture>(@"images\thumb.png"));
            lb.Items.Add(new ListBoxItem(""));

            AddControl(lb);

            var s = new Slider(new Vector3(300, 100, 400), false,
                               ScreenManager.Content.Load<APNGTexture>(@"images\thumb.png"),
                               ScreenManager.Content.Load<APNGTexture>(@"images\thumb_hover.png"))
                        {
                            ThumbLocation = 1f,
                        };

            s.OnDrag += sender =>
                            {
                                DebugScreen.Output(sender.ThumbLocation.ToString());
                            };

            AddControl(s);

            base.InitializeControls();
        }
开发者ID:xupefei,项目名称:EAGSS,代码行数:25,代码来源:TestScreen.cs


示例2: MainForm

	public MainForm ()
	{
		// 
		// _listBox
		// 
		_listBox = new ListBox ();
		_listBox.DisplayMember = "Name";
		_listBox.Location = new Point (8, 8);
		_listBox.Size = new Size (100, 60);
		_listBox.ValueMember = "Value";
		Controls.Add (_listBox);
		// 
		// 
		// 
		_clearButton = new Button ();
		_clearButton.Location = new Point (140, 30);
		_clearButton.Text = "Clear";
		_clearButton.Click += new EventHandler (ClearButton_Click);
		Controls.Add (_clearButton);
		// 
		// MainForm
		// 
		ClientSize = new Size (240, 80);
		Location = new Point (300, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #81788";
		Load += new EventHandler (MainForm_Load);
	}
开发者ID:mono,项目名称:gert,代码行数:28,代码来源:MainForm.cs


示例3: FillLbCounty

 public static void FillLbCounty(ListBox lb,string baseSite)
 {
     using (System.Net.WebClient wc = new System.Net.WebClient()) {
         string html = wc.DownloadString(baseSite+"state_link_page.html");
         //Check if page is meant to contain archived caches
         Regex ar = new Regex(@"archived-GLX");
         if (ar.IsMatch(html)) {
             //parse country/county name and link to glx, both terms separated by non-greedy match .*?
             //previous version: @"cachelink[^>]+href[^>]+\.html[^>]+>([^<]*)<.*?<a[^>]+href=""([^""]*\.glx)""",
             Regex rgc = new Regex(
                     @"<tr(?:\n|.)*?<td.*?CacheList.*?(?:\n|.)*?/td>(?:\n|.)*?<td[^>]*>([^<]*)</td>(?:\n|.)*?<a[^>]*cachelink[^>]+href[^>]+\.html[^>]+>(?:\n|.)*?<a[^>]+href=""([^""]*\.glx)"""
                     ,RegexOptions.Singleline);
             MatchCollection mc = rgc.Matches(html);
             
             foreach (Match m in mc) {
                 //htmldecode translates html entities 
                 LbLink cl = new LbLink(m.Groups[2].Value,
                                     System.Net.WebUtility.HtmlDecode(m.Groups[1].Value));
                 lb.Items.Add(cl);
             }
             if (lb.Items.Count>0) {
                 lb.SelectedIndex=0;
             }
         } else {
             System.Windows.Forms.MessageBox.Show("Sorry: The directory of archived Caches on xylanthrop.de is of unknown format.");
         }
     }
 }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:28,代码来源:Update+Archived+from+Xylanthrop.cs


示例4: ToolsListBox_SelectedItemChanged

        private void ToolsListBox_SelectedItemChanged(object sender, ListBox<ListBoxItem>.SelectedItemEventArgs e)
        {
            if (selectedTool != null)
            {
                selectedTool.OnDeselected();
                //if (selectedTool.ControlPanels != null)
                //    foreach (var pane in selectedTool.ControlPanels)
                //    {
                //        foreach (var control in pane.Controls)
                //        {
                //            Remove(control);
                //        }
                //    }
            }

            if (e.Item != null)
            {
                selectedTool = (ITool)e.Item;
                EditorConsoleManager.ToolName = selectedTool.Title;

                //EditorConsoleManager.AllowKeyboardToMoveConsole = true;

                Panels.CharacterPickPanel.SharedInstance.HideCharacter = false;
                Panels.CharacterPickPanel.SharedInstance.HideForeground = false;
                Panels.CharacterPickPanel.SharedInstance.HideBackground = false;

                selectedTool.OnSelected();
                Panels.CharacterPickPanel.SharedInstance.Reset();
            }
        }
开发者ID:Thraka,项目名称:SadConsoleEditor,代码行数:30,代码来源:ToolsPanel.cs


示例5: cargarLista

 protected void cargarLista(ListBox lista)
 {
     lista.DataSource = CursoDao.ObtenerTodo();
     lista.DataValueField = "id_curso";
     lista.DataTextField = "nombre";
     lista.DataBind();
 }
开发者ID:nyasan,项目名称:SI-ASA,代码行数:7,代码来源:InscripcionAlumnoACursos.aspx.cs


示例6: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        sysManager = new SystemExerciseManager();
        routManager = new routineManager();
        logManager = new LoggedExerciseManager();

        lb = (ListBox)this.Parent.FindControl("lbRoutines");

        if (Session["loggedExerciseID"] != null)
        {
            loggedExerciseID = (int)Session["loggedExerciseID"];
        }

        if (!IsPostBack)
        {
            Session.Abandon();
            pnlSets.Visible = false;
        }

        if (lb != null && lb.SelectedIndex > -1)
        {
            routineID = Convert.ToInt32(lb.SelectedItem.Value);
            GridView1.DataSource = routManager.getLoggedExercises(userID, routineID);
            GridView1.DataBind();
            pnlSets.Visible = false;
        }
    }
开发者ID:andeic,项目名称:Project-LimitBreaker,代码行数:27,代码来源:ucModifyDeleteRoutineLog.ascx.cs


示例7: DataContexts_Should_Be_Correctly_Set

        public void DataContexts_Should_Be_Correctly_Set()
        {
            var items = new object[]
            {
                "Foo",
                new Item("Bar"),
                new TextBlock { Text = "Baz" },
                new ListBoxItem { Content = "Qux" },
            };

            var target = new ListBox
            {
                Template = new FuncControlTemplate(CreateListBoxTemplate),
                DataContext = "Base",
                DataTemplates = new DataTemplates
                {
                    new FuncDataTemplate<Item>(x => new Button { Content = x })
                },
                Items = items,
            };

            target.ApplyTemplate();

            var dataContexts = target.Presenter.Panel.Children
                .Cast<Control>()
                .Select(x => x.DataContext)
                .ToList();

            Assert.Equal(
                new object[] { items[0], items[1], "Base", "Base" },
                dataContexts);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:32,代码来源:ListBoxTests.cs


示例8: DataContexts_Should_Be_Correctly_Set

        public void DataContexts_Should_Be_Correctly_Set()
        {
            using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
            {
                var items = new object[]
                {
                    "Foo",
                    new Item("Bar"),
                    new TextBlock { Text = "Baz" },
                    new ListBoxItem { Content = "Qux" },
                };

                var target = new ListBox
                {
                    Template = ListBoxTemplate(),
                    DataContext = "Base",
                    DataTemplates = new DataTemplates
                {
                    new FuncDataTemplate<Item>(x => new Button { Content = x })
                },
                    Items = items,
                };

                Prepare(target);

                var dataContexts = target.Presenter.Panel.Children
                    .Cast<Control>()
                    .Select(x => x.DataContext)
                    .ToList();

                Assert.Equal(
                    new object[] { items[0], items[1], "Base", "Base" },
                    dataContexts);
            }
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:35,代码来源:ListBoxTests.cs


示例9: ShowDialog

 public static string ShowDialog(string baseSite,string text, string caption)
 {
     Form prompt = new Form();
     string resultURL="";
     prompt.Width = 600;
     prompt.Height = 420;
     prompt.Text = caption;
     
     Label textLabel = new Label() { Left = 10, Top=10, Width=580, Text=text };
     ListBox lbCounty = new ListBox() { Left = 10, Top=40, Width=250, Height = 340, DisplayMember = "Label" };
     Button confirmation = new Button() { Text = "Ok", Left=370, Width=100, Top=350 };
     Button cancel = new Button() { Text = "Cancel", Left=480, Width=100, Top=350 };
     
     confirmation.Click += (sender, e) => {
             if(lbCounty.SelectedItem!=null) {resultURL=lbCounty.SelectedItem.ToString();}
             prompt.Close();
         };
     lbCounty.DoubleClick += (sender, e) => { confirmation.PerformClick();};
     cancel.Click += (sender, e) => { resultURL = "";prompt.Close(); };
     
     prompt.Controls.Add(confirmation);
     prompt.Controls.Add(cancel);
     prompt.Controls.Add(textLabel);
     prompt.Controls.Add(lbCounty);
     
     FillLbCounty(lbCounty,baseSite);
     
     prompt.ShowDialog();
     return resultURL;
 }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:30,代码来源:Update+Archived+from+Xylanthrop.cs


示例10: mnuHelpTopics

        public mnuHelpTopics(string name)
            : base(name)
        {
            this.Size = new Size(185, 220);
            this.MenuDirection = Enums.MenuDirection.Vertical;
            this.Location = new Point(10, 40);

            lblHelpTopics = new Label("lblHelpTopics");
            lblHelpTopics.Location = new Point(20, 0);
            lblHelpTopics.Font = FontManager.LoadFont("PMU", 36);
            lblHelpTopics.AutoSize = true;
            lblHelpTopics.Text = "Help Topics";
            lblHelpTopics.ForeColor = Color.WhiteSmoke;

            lstHelpTopics = new ListBox("lstHelpTopics");
            lstHelpTopics.Location = new Point(10, 50);
            lstHelpTopics.Size = new Size(this.Width - lstHelpTopics.X * 2, this.Height - lstHelpTopics.Y - 10 - 30);
            lstHelpTopics.BackColor = Color.Transparent;
            lstHelpTopics.BorderStyle = SdlDotNet.Widgets.BorderStyle.None;

            btnShowHelp = new Button("btnShowHelp");
            btnShowHelp.Location = new Point(10, lstHelpTopics.Y + lstHelpTopics.Height + 5);
            btnShowHelp.Size = new Size(100, 30);
            btnShowHelp.Text = "Load Topic";
            Skins.SkinManager.LoadButtonGui(btnShowHelp);
            btnShowHelp.Click += new EventHandler<MouseButtonEventArgs>(btnShowHelp_Click);

            this.AddWidget(lblHelpTopics);
            this.AddWidget(lstHelpTopics);
            this.AddWidget(btnShowHelp);

            LoadHelpTopics();
        }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:33,代码来源:mnuHelpTopics.cs


示例11: GetListBoxSelValueInComma

    public string GetListBoxSelValueInComma(ListBox Listbox1)
    {
        string selectedItem = "";
        if (Listbox1.Items.Count > 0)
        {
            if (Listbox1.SelectedValue.ToString() == "0")
            {
                for (int i = 0; i < Listbox1.Items.Count; i++)
                {
                    if (selectedItem == "")
                        selectedItem = Listbox1.Items[i].Value;
                    else
                        selectedItem += "\",\"" + Listbox1.Items[i].Value;
                }
            }
            else
            {
                for (int i = 0; i < Listbox1.Items.Count; i++)
                {
                    if (Listbox1.Items[i].Selected)
                    {
                        if (selectedItem == "")
                            selectedItem = Listbox1.Items[i].Value;
                        else
                            selectedItem += "\",\"" + Listbox1.Items[i].Value;
                    }

                }
            }
        }
        selectedItem = "\"" + selectedItem + "\"";
        return selectedItem;
    }
开发者ID:jigshGitHub,项目名称:SandlerTrainingDevelopment,代码行数:33,代码来源:RDLReports.aspx.cs


示例12: HelloForm

    public HelloForm()
    {
        this.Text = "Hello Form";
        this.StartPosition = FormStartPosition.CenterScreen;
        this.FormBorderStyle = FormBorderStyle.FixedDialog;
        this.ControlBox = true;
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.BackColor = Color.Red;

        lb = new ListBox();
        lb.Left = 5;
        lb.Width = this.Width - 20;
        lb.Top = this.Height/6;
        lb.Font = new Font(lb.Font, FontStyle.Bold);

        for (int i = 0; i < strLines.Length; ++i)
        {
            lb.Items.Add(strLines[i]);
        }

        lb2 = new ListBox();
        lb2.Left = 5;
        lb2.Width = this.Width - 20;
        lb2.Top = this.Height - 140;
        lb2.Font = new Font(lb.Font, FontStyle.Bold);
        _items.Add("One"); // <-- Add these
        _items.Add("Two");
        _items.Add("Three");

        lb2.DataSource = _items;

        this.Controls.Add(lb);
        this.Controls.Add(lb2);
    }
开发者ID:dbremner,项目名称:hycs,代码行数:35,代码来源:listbox.cs


示例13: ListWithListBoxItems

    public ListWithListBoxItems()
    {
        Title = "List with ListBoxItem";

        ListBox lstbox = new ListBox();
        lstbox.Height = 150;
        lstbox.Width = 150;
        lstbox.SelectionChanged += ListBoxOnSelectionChanged;
        Content = lstbox;

        PropertyInfo[] props = typeof(Colors).GetProperties();

        foreach (PropertyInfo prop in props)
        {
            Color clr = (Color)prop.GetValue(null, null);
            bool isBlack = .222 * clr.R + .707 * clr.G + .071 * clr.B > 128;

            ListBoxItem item = new ListBoxItem();
            item.Content = prop.Name;
            item.Background = new SolidColorBrush(clr);
            item.Foreground = isBlack ? Brushes.Black : Brushes.White;
            item.HorizontalContentAlignment = HorizontalAlignment.Center;
            item.Padding = new Thickness(2);
            lstbox.Items.Add(item);
        }
    }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:26,代码来源:ListWithListBoxItems.cs


示例14: RemoteSwitchGUI

    public RemoteSwitchGUI()
    {
        Text = "Remote Switch GUI 1.0.1";
        Size = new Size(300, 500);
        MinimumSize = new Size(260, 200);

        panel = new Panel();
        panel.Parent = this;
        panel.Height = 40;
        panel.Dock = DockStyle.Top;

        listBox = new ListBox();
        listBox.Parent = this;
        listBox.Dock = DockStyle.Fill;
        listBox.BringToFront();

        buttonAOn  = CreateButton("A On",   10, (1 << 0) | (1 << 2));
        buttonAOff = CreateButton("A Off",  70, (1 << 0) | (1 << 3));
        buttonBOn  = CreateButton("B On",  130, (1 << 1) | (1 << 2));
        buttonBOff = CreateButton("B Off", 190, (1 << 1) | (1 << 3));

        Load += delegate(object sender, System.EventArgs e)
        {
            Thread thread = new Thread(delegate() { Connect(); });
            thread.IsBackground = true;
            thread.Start();
        };
    }
开发者ID:bojanb,项目名称:hardware-hacking,代码行数:28,代码来源:RemoteSwitchGUI.cs


示例15: Initialize

        protected override void Initialize()
        {
            base.Initialize();

            //create a bunch of UI elements and link them to the state
            ScrollPanel panel = new ScrollPanel(0, 0, 0, 400, 640, this);
            panel.SetBackgroundColor(Color4.Red);
            ScrollPanel panel2 = new ScrollPanel(420, 10, 0, 350, 500, this);

            panel.SetContentDimensions(800, 800);
            panel2.SetContentDimensions(400, 400);

            Button button = new Button(10, 50, 0, 100, 100, "button.png", "button", this);
            TextField field = new TextField(10, 10, 0, 100, this);
            ListBox listBox = new ListBox(120, 10, 0, 200, 150, 10, this);

            DropDownBox dropDown = new DropDownBox(50, 420, 0, 100, this);

            TextBox textBox = new TextBox(10, 10, 0, 400, 400, this);
            RadioButton radio = new RadioButton(200, 420, 0, this);

            panel.AddControl(panel2);

            panel.AddControl(dropDown);
            panel.AddControl(textBox);
            panel.AddControl(radio);

            panel2.AddControl(button);
            panel2.AddControl(field);
            panel2.AddControl(listBox);

            this.AddControl(panel);
        }
开发者ID:jikoriko,项目名称:OpentkEngine,代码行数:33,代码来源:GuiState.cs


示例16: Initialize

        public static void Initialize()
        {
            notificationbox = new ListBox(P._Canvas);
            notificationbox.SetBounds(4, 2 * P.ScreenSize.Y / 3 + 16, P.ScreenSize.X - 8, P.ScreenSize.Y - (2 * P.ScreenSize.Y / 3 + 16) - 24);
            notificationbox.EnableScroll(false, true);

            AddNotification("           -----Notifications Show Up Here-----");
        }
开发者ID:Sprunth,项目名称:Book-Publishing-Nation,代码行数:8,代码来源:Notifications.cs


示例17: KeyValueEditPopup

        public KeyValueEditPopup(Dictionary<string, string> settings)
            : base(55, 18)
        {
            Title = "Settings";

            // Setting controls of the game object
            objectSettingsListbox = new ListBox(25, 10);
            settingNameInput = new InputBox(25);
            settingValueInput = new InputBox(25);
            objectSettingsListbox.HideBorder = true;

            objectSettingsListbox.Position = new Point(2, 3);
            settingNameInput.Position = new Point(objectSettingsListbox.Bounds.Right + 1, objectSettingsListbox.Bounds.Top);
            settingValueInput.Position = new Point(objectSettingsListbox.Bounds.Right + 1, settingNameInput.Bounds.Bottom + 2);

            addFieldButton = new Button(14, 1);
            addFieldButton.Text = "Add/Update";
            addFieldButton.Position = new Point(settingValueInput.Bounds.Left, settingValueInput.Bounds.Bottom + 1);

            removeFieldButton = new Button(14, 1);
            removeFieldButton.Text = "Remove";
            removeFieldButton.Position = new Point(objectSettingsListbox.Bounds.Left, objectSettingsListbox.Bounds.Bottom + 1);
            removeFieldButton.IsEnabled = false;

            objectSettingsListbox.SelectedItemChanged += _objectSettingsListbox_SelectedItemChanged;
            addFieldButton.ButtonClicked += _addFieldButton_ButtonClicked;
            removeFieldButton.ButtonClicked += _removeFieldButton_ButtonClicked;

            Add(objectSettingsListbox);
            Add(settingNameInput);
            Add(settingValueInput);
            Add(addFieldButton);
            Add(removeFieldButton);

            // Save/close buttons
            saveButton = new Button(10, 1);
            cancelButton = new Button(10, 1);

            saveButton.Text = "Save";
            cancelButton.Text = "Cancel";

            saveButton.ButtonClicked += _saveButton_ButtonClicked;
            cancelButton.ButtonClicked += (o, e) => { DialogResult = false; Hide(); };

            saveButton.Position = new Point(textSurface.Width - 12, 16);
            cancelButton.Position = new Point(2, 16);

            Add(saveButton);
            Add(cancelButton);

            // Read the settings
            foreach (var item in settings)
                objectSettingsListbox.Items.Add(new SettingKeyValue() { Key = item.Key, Value = item.Value });

            SettingsDictionary = settings;

            Redraw();
        }
开发者ID:Thraka,项目名称:SadConsoleEditor,代码行数:58,代码来源:KeyValueEditPopup.cs


示例18: mnuChangeWeather

        public mnuChangeWeather(string name, int price)
            : base(name)
        {
            this.price = price;

            this.Size = new Size(250, 250);
            this.MenuDirection = Enums.MenuDirection.Vertical;
            this.Location = Client.Logic.Graphics.DrawingSupport.GetCenter(Windows.WindowSwitcher.GameWindow.MapViewer.Size, this.Size);

            lblAddTile = new Label("lblAddTile");
            lblAddTile.Location = new Point(25, 15);
            lblAddTile.AutoSize = false;
            lblAddTile.Size = new System.Drawing.Size(this.Width - lblAddTile.X * 2, 20);
            lblAddTile.Text = "Choose a weather condition:";
            lblAddTile.ForeColor = Color.WhiteSmoke;

            lstSound = new ListBox("lstSound");
            lstSound.Location = new Point(lblAddTile.X, lblAddTile.Y + lblAddTile.Height);
            lstSound.Size = new Size(180, 120);

                SdlDotNet.Graphics.Font font = Logic.Graphics.FontManager.LoadFont("PMDCP", 18);
                //string[] sfxFiles = System.IO.Directory.GetFiles(IO.Paths.SfxPath);
                for (int i = 1; i < 12; i++) {
                    if ((Enums.Weather)i != Enums.Weather.DiamondDust) {
                        lstSound.Items.Add(new ListBoxTextItem(font, ((Enums.Weather)i).ToString()));
                    }
                }
                lstSound.SelectedIndex = 0;

            lblPrice = new Label("lblPrice");
            lblPrice.Location = new Point(lblAddTile.X, lstSound.Y + lstSound.Height + 10);
            lblPrice.AutoSize = false;
            lblPrice.Size = new System.Drawing.Size(180, 30);
            lblPrice.Text = "Changing the weather will cost " + price + " " + Items.ItemHelper.Items[1].Name + ".";
            lblPrice.ForeColor = Color.WhiteSmoke;

            btnAccept = new Button("btnAccept");
            btnAccept.Location = new Point(lblAddTile.X, lblPrice.Y + lblPrice.Height + 10);
            btnAccept.Size = new Size(80, 30);
            btnAccept.Text = "Set Weather";
            btnAccept.Font = FontManager.LoadFont("tahoma", 10);
            Skins.SkinManager.LoadButtonGui(btnAccept);
            btnAccept.Click += new EventHandler<MouseButtonEventArgs>(btnAccept_Click);

            btnCancel = new Button("btnCancel");
            btnCancel.Location = new Point(btnAccept.X + btnAccept.Width, lblPrice.Y + lblPrice.Height + 10);
            btnCancel.Size = new Size(80, 30);
            btnCancel.Text = "Cancel";
            btnCancel.Font = FontManager.LoadFont("tahoma", 10);
            Skins.SkinManager.LoadButtonGui(btnCancel);
            btnCancel.Click += new EventHandler<MouseButtonEventArgs>(btnCancel_Click);

            this.AddWidget(lblAddTile);
            this.AddWidget(lstSound);
            this.AddWidget(lblPrice);
            this.AddWidget(btnAccept);
            this.AddWidget(btnCancel);
        }
开发者ID:blastboy,项目名称:Client,代码行数:58,代码来源:mnuChangeWeather.cs


示例19: HotspotToolPanel

        public HotspotToolPanel()
        {
            Title = "Hotspots";

            hotspotsListbox = new ListBox<HotspotListBoxItem>(Consoles.ToolPane.PanelWidthControls, 7);
            createButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            editButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            deleteButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            exportListButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            cloneHotspot = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            importListButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);

            hotspotsListbox.SelectedItemChanged += hotspotsListbox_SelectedItemChanged;
            createButton.ButtonClicked += _createNewObjectButton_ButtonClicked;
            editButton.ButtonClicked += _editObjectButton_ButtonClicked;
            deleteButton.ButtonClicked += _deleteObjectButton_ButtonClicked;
            exportListButton.ButtonClicked += _exportListButton_ButtonClicked;
            cloneHotspot.ButtonClicked += CloneHotspot_ButtonClicked;
            importListButton.ButtonClicked += ImportListButton_ButtonClicked;

            editButton.IsEnabled = false;
            deleteButton.IsEnabled = false;
            cloneHotspot.IsEnabled = false;

            hotspotsListbox.HideBorder = true;

            createButton.Text = "Define New";
            editButton.Text = "Edit";
            deleteButton.Text = "Delete";
            exportListButton.Text = "Export";
            cloneHotspot.Text = "Clone";
            importListButton.Text = "Import";

            drawHotspotsCheckbox = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            drawHotspotsCheckbox.IsSelected = true;
            drawHotspotsCheckbox.Text = "Draw hotspots";

            Controls = new ControlBase[] { createButton, null, hotspotsListbox, null, editButton, cloneHotspot, deleteButton, null, exportListButton, importListButton, null, drawHotspotsCheckbox };

            // Load the known object types.
            //if (System.IO.File.Exists(Settings.FileObjectTypes))
            //{
            //    using (var fileObject = System.IO.File.OpenRead(Settings.FileObjectTypes))
            //    {
            //        var serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(GameObject[]));

            //        var gameObjects = serializer.ReadObject(fileObject) as GameObject[];

            //        foreach (var item in gameObjects)
            //        {
            //            var newItem = new GameObjectMeta(item, true);
            //            hotspotsListbox.Items.Add(newItem);
            //        }
            //    }
            //}

            exportListButton.IsEnabled = hotspotsListbox.Items.Count != 0;
        }
开发者ID:Thraka,项目名称:SadConsoleEditor,代码行数:58,代码来源:HotspotTool.Panel.cs


示例20: PopulateListBox

 private void PopulateListBox(ListBox listBox)
 {
     listBox.Items.Clear();
     XmlNodeList nodes = _xmlDocument.SelectNodes("listboxes/" + listBox.ClientID + "/option");
     foreach (XmlNode node in nodes)
     {
         listBox.Items.Add(new ListItem(HttpUtility.UrlDecode(node["key"].InnerText), HttpUtility.UrlDecode(node["value"].InnerText)));
     }
 }
开发者ID:cstruter,项目名称:MovingItemsBetweenListBoxes,代码行数:9,代码来源:ListPicker.ascx.cs



注:本文中的ListBox类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ListCreationInformation类代码示例发布时间:2022-05-24
下一篇:
C# List类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap