当前位置: 首页>>代码示例>>C#>>正文


C# ListBox.EndUpdate方法代码示例

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


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

示例1: InitializeComponent

    private void InitializeComponent()
    {
        Text = "LayoutDemo";
        AutoScaleBaseSize = new Size(5, 13);
        MinimumSize = new Size(280, 305);
        ClientSize = new Size(392, 342);

        inputBox = new TextBox();
        inputBox.Location = new Point(16, 24);
        inputBox.Text = "Windows Forms Layout Demo";
        inputBox.TabIndex = 0;
        inputBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
        inputBox.Size = new Size(360, 20);
        Controls.Add(inputBox);

        listBox = new ListBox();
        listBox.Location = new Point(16, 60);
        listBox.Size = new Size(250, 100);
        listBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
        listBox.BeginUpdate();
        for (int i = 1; i <= 20; i++) {
            listBox.Items.Add("Item " + i.ToString());
        }
        listBox.EndUpdate();
        listBox.SelectedIndex = 0;
        Controls.Add(listBox);
        
        logo = new PictureBox();
        logo.Image = Image.FromFile("xml11_tiny.jpg");
        logo.Location = new Point(282, 60);
        logo.Anchor = AnchorStyles.Top | AnchorStyles.Right;
        Controls.Add(logo);

        textBox = new TextBox();
        textBox.Location = new Point(16, 174);
        textBox.Multiline = true;
        textBox.ScrollBars = ScrollBars.Vertical;
        textBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
        textBox.Size = new Size(360, 100);
        Controls.Add(textBox);

        buttonDump = new Button();
        buttonDump.Size = new Size(60, 30);
        buttonDump.TabIndex = 1;
        buttonDump.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
        buttonDump.Location = new Point(164, 296);
        buttonDump.Text = "Dump";
        buttonDump.Click += new EventHandler(ClickDump);
        Controls.Add(buttonDump);

        buttonClear = new Button();
        buttonClear.Size = new Size(60, 30);
        buttonClear.TabIndex = 1;
        buttonClear.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
        buttonClear.Location = new Point(240, 296);
        buttonClear.Text = "Clear";
        buttonClear.Click += new EventHandler(ClickClear);
        Controls.Add(buttonClear);

        buttonExit = new Button();
        buttonExit.Size = new Size(60, 30);
        buttonExit.TabIndex = 1;
        buttonExit.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
        buttonExit.Location = new Point(316, 296);
        buttonExit.Text = "Exit";
        buttonExit.Click += new EventHandler(ClickExit);
        Controls.Add(buttonExit);
    }
开发者ID:deepakworld07,项目名称:xmlvm.svn,代码行数:68,代码来源:LayoutDemo.cs

示例2: editIlasm

	public static void editIlasm(ListBox lb)
	{
		//shows a dialog for the user to edit il code then sticks modified il in listbox
		editIlDialog ed = new editIlDialog();
		StringBuilder sb = new StringBuilder();
		bool first = true;
		foreach(object o in lb.Items)
		{
			if (first == true)
			{
				first = false;
			}
			else
			{
				sb.Append("\r\n");
			}
			sb.Append(o.ToString());
		}
		ed.il = sb.ToString();
		if (ed.ShowDialog() == DialogResult.OK)
		{
			string[] str = ed.il.Split("\n".ToCharArray());
			lb.BeginUpdate();
			lb.Items.Clear();
			foreach (string s in str)
			{
				lb.Items.Add(s.Trim());
			}
			lb.EndUpdate();
		}
	}
开发者ID:winch,项目名称:winch.pinkbile.com-c-sharp,代码行数:31,代码来源:editIlDialog.cs


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