本文整理汇总了C#中ListBox.RemoveSelectedItems方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.RemoveSelectedItems方法的具体用法?C# ListBox.RemoveSelectedItems怎么用?C# ListBox.RemoveSelectedItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListBox
的用法示例。
在下文中一共展示了ListBox.RemoveSelectedItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitLayerSettingsWindow
protected void InitLayerSettingsWindow()
{
LayerSettingsWindow = new Window(UI.GetInterface(Name), null, "Settings", TextOrientation.Center, Vector2.Zero, new Vector2(712, 500), true, false, false, false);
LayerSettingsWindow.AddElement(new Label(UI.GetInterface(Name), "Layer Name", 14, TextOrientation.Left, new Vector2(10, 10), new Vector2(200, 25), Color.Black, Color.Transparent));
LayerSettingsWindow.AddElement(new TextBox(UI.GetInterface(Name), layerName, 14, 20, new Vector2(10, 40), new Vector2(200, 25), Color.Black, Color.White, origin, Color.Black));
LayerSettingsWindow.AddElement(new Label(UI.GetInterface(Name), "Available Traits", 14, TextOrientation.Left, new Vector2(10, 80), new Vector2(200, 50), Color.Black, Color.Transparent));
LayerSettingsWindow.AddElement(new Label(UI.GetInterface(Name), "Contained Traits", 14, TextOrientation.Left, new Vector2(400, 80), new Vector2(200, 50), Color.Black, Color.Transparent));
LayerSettingsWindow.AddElement(new Button(UI.GetInterface(Name), ">", 24, TextOrientation.Center, new Vector2(330, 230), new Vector2(50, 50), origin, hover, pressed));
LayerSettingsWindow.AddElement(new Button(UI.GetInterface(Name), "<", 24, TextOrientation.Center, new Vector2(330, 290), new Vector2(50, 50), origin, hover, pressed));
ListBox a = new ListBox(UI.GetInterface(Name), 14, TextOrientation.Left, new Vector2(10, 110), new Vector2(300, 350), Color.Black, Color.White, origin, hover);
ListBox b = new ListBox(UI.GetInterface(Name), 14, TextOrientation.Left, new Vector2(400, 110), new Vector2(300, 350), Color.Black, Color.White, origin, hover);
LayerSettingsWindow.AddElement(a);
LayerSettingsWindow.AddElement(b);
availableTraits.Add("Affects Movement Speed");
availableTraits.Add("Cast Shadow");
availableTraits.Add("Collision");
availableTraits.Add("Function Layer");
availableTraits.Add("Transparent");
availableTraits.Add("Stainable");
availableTraits.Add("Projectile Collision");
availableTraits.Add("NPC Collision");
availableTraits.Add("Item Collision");
a.AddItem(availableTraits[0]);
a.AddItem(availableTraits[1]);
a.AddItem(availableTraits[2]);
a.AddItem(availableTraits[3]);
a.AddItem(availableTraits[4]);
a.AddItem(availableTraits[5]);
a.AddItem(availableTraits[6]);
a.AddItem(availableTraits[7]);
a.AddItem(availableTraits[8]);
(LayerSettingsWindow[1] as TextBox).TextChanged += (sender) =>
{
TextBox tb = sender as TextBox;
if (tb.Text != "")
layerName = tb.Text;
};
LayerSettingsWindow[4].Clicked += (sender) =>
{
if (a.SelectedItems.Count > 0)
{
for (int i = 0; i < a.SelectedItems.Count; i++)
{
b.AddItem(a.SelectedItems[i]);
}
a.RemoveSelectedItems();
}
};
LayerSettingsWindow[5].Clicked += (sender) =>
{
if (b.SelectedItems.Count > 0)
{
for (int i = 0; i < b.SelectedItems.Count; i++)
{
a.AddItem(b.SelectedItems[i]);
}
b.RemoveSelectedItems();
}
};
LayerSettingsWindow.Open(new Vector2(Game1.ScreenWidth / 2.0f - LayerSettingsWindow.Size.X / 2.0f, Game1.ScreenHeight / 2.0f - LayerSettingsWindow.Size.Y / 2.0f));
}