本文整理汇总了C#中System.Windows.Forms.ListBox类的典型用法代码示例。如果您正苦于以下问题:C# ListBox类的具体用法?C# ListBox怎么用?C# ListBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListBox类属于System.Windows.Forms命名空间,在下文中一共展示了ListBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Continent
public Continent(ListBox displayBox, Random rGen, int nAnimalTypes, Graphics canvas)
{
this.displayBox = displayBox;
this.rGen = rGen;
this.nAnimalTypes = nAnimalTypes;
this.canvas = canvas;
}
开发者ID:watset1,项目名称:IN710watset1,代码行数:7,代码来源:Continent.cs
示例2: RefreshListBox
private static void RefreshListBox(ListBox log, string[] items)
{
var selectLastIndex = log.Items.Count == 0 || log.SelectedIndex == log.Items.Count - 1;
log.DataSource = items;
if (selectLastIndex && log.Items.Count > 0)
log.SelectedIndex = log.Items.Count - 1;
}
开发者ID:phiree,项目名称:gitextensions,代码行数:7,代码来源:GitLogForm.cs
示例3: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm));
this.label1 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(64, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(248, 32);
this.label1.TabIndex = 1;
this.label1.Text = "HyperLoad 2.0";
//
// listBox1
//
this.listBox1.Items.AddRange(new object[] {
"This program is completely free to use!",
"",
"Hyperload is an open-source program that can be used to",
"program *.HEX files to your microcontroller.",
"",
"The Hyperload Protocol & related information can be found at:",
"www.sociaLLedge.com/sjsu"});
this.listBox1.Location = new System.Drawing.Point(14, 84);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(304, 108);
this.listBox1.TabIndex = 5;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.listBox1);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(320, 210);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
//
// AboutForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(338, 225);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "About";
this.Deactivate += new System.EventHandler(this.AboutForm_Deactivate);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
开发者ID:kammce,项目名称:SJSU-DEV-Linux,代码行数:64,代码来源:AboutForm.cs
示例4: SetUp
protected override void SetUp ()
{
listBox = new ListBox();
form = new Form();
form.ShowInTaskbar = false;
base.SetUp ();
}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:ListBoxTest.cs
示例5: PreferenceListDetails
public PreferenceListDetails(PreferenceList preferenceList, ListBox listBox, Button buttonUp, Button buttonDown)
{
_preferenceList = preferenceList;
_list = listBox;
_up = buttonUp;
_down = buttonDown;
}
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:7,代码来源:PreferenceListDetails.cs
示例6: InitTabControlPages
private void InitTabControlPages()
{
foreach(var obj in CardLevels)
{
var page = new TabPage { Text = CardLevel.RoleCardLevelName(obj) };
CardTabControl.TabPages.Add(page);
var listData = new BindingList<RoleCard>();
var list = new ListBox()
{
Dock = DockStyle.Fill,
ContextMenuStrip = TabControlContextMenu,
DisplayMember = "Name",
ValueMember = "Id",
DataSource = listData,
};
list.SelectedIndexChanged += (sender, msg) =>
{
var item = list.SelectedItem as RoleCard;
if (ListOfRoleCardList[CardTabControl.SelectedIndex].Contains(item))
{
SelectedItem = item;
cardInfoControl1.BeginModify();
cardInfoControl1.Images = CardImageDictionary[SelectedItem.Id];
cardInfoControl1.RoleCard = SelectedItem;
cardInfoControl1.EndModify();
}
};
page.Controls.Add(list);
ListOfRoleCardList.Add(listData);
}
}
开发者ID:xxy1991,项目名称:cozy,代码行数:35,代码来源:EditorForm.cs
示例7: SaveCurrentEnvironment
public static void SaveCurrentEnvironment(LoadedSettings loadedSettings, ListBox environmentsListBox, EnvironmentStruct environment)
{
var currentEnvironment = loadedSettings.Environments.First(env => env.ID == environment.ID);
if (environment.ID == Guid.Empty) return;
if (currentEnvironment.Name != environment.Name)
currentEnvironment.Name = environment.Name;
if (currentEnvironment.SubkeyValue != environment.SubkeyValue)
currentEnvironment.SubkeyValue = environment.SubkeyValue;
if (currentEnvironment.HotKey != environment.HotKey)
currentEnvironment.HotKey = environment.HotKey;
if (currentEnvironment.IconLabel != environment.IconLabel)
currentEnvironment.IconLabel = environment.IconLabel;
if (currentEnvironment.IconTextColor != environment.IconTextColor)
currentEnvironment.IconTextColor = environment.IconTextColor;
if (currentEnvironment.IconBackgroundColor != environment.IconBackgroundColor)
currentEnvironment.IconBackgroundColor = environment.IconBackgroundColor;
if (currentEnvironment.LoadIcon != environment.LoadIcon)
currentEnvironment.LoadIcon = environment.LoadIcon;
if (currentEnvironment.IconFileLocation != environment.IconFileLocation)
currentEnvironment.IconFileLocation = environment.IconFileLocation;
if (currentEnvironment.DisplayOnMenu != environment.DisplayOnMenu)
currentEnvironment.DisplayOnMenu = environment.DisplayOnMenu;
ListboxUtils.RepopulateListBox(true, environmentsListBox, loadedSettings, environment.ID);
ListboxUtils.SetCurrentOrderFromListBoxAndSave(true, environmentsListBox, loadedSettings);
MessageBox.Show($"{currentEnvironment.Name} {Constants.Messages.SavedSuccessfully}",
$"Environment {Constants.Messages.SavedSuccessfullyCaption}",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
开发者ID:gr0ss,项目名称:RegistryMonitor,代码行数:32,代码来源:EnvironmentUtils.cs
示例8: add_list_content
public void add_list_content(ListBox listbox, ArrayList strings)
{
foreach (String name in strings)
{
listbox.Items.Add(name);
}
}
开发者ID:ruxeom,项目名称:RO-Skill-Simulator,代码行数:7,代码来源:SkillLinker.cs
示例9: ShowResponse
public void ShowResponse(IRequest request, Uri response)
{
_guiContext.Post(_ =>
{
foreach (TabPage source in responsesTab.TabPages)
{
if (source.Text.Equals(request.SearchCriteria.Value))
{
ListBox list;
if (source.Controls.Count == 0)
{
list = new ListBox {Dock = DockStyle.Fill};
source.Controls.Add(list);
}
else
list = source.Controls[0] as ListBox;
if (list != null)
{
list.Items.Add(response);
}
break;
}
}
}, null);
}
开发者ID:Sorcha,项目名称:SD-Trabalho1,代码行数:26,代码来源:MusicWindow.cs
示例10: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lbNodes = new System.Windows.Forms.ListBox();
this.btnLoadXml = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lbNodes
//
this.lbNodes.Location = new System.Drawing.Point(8, 40);
this.lbNodes.Name = "lbNodes";
this.lbNodes.Size = new System.Drawing.Size(432, 303);
this.lbNodes.TabIndex = 3;
//
// btnLoadXml
//
this.btnLoadXml.Location = new System.Drawing.Point(8, 8);
this.btnLoadXml.Name = "btnLoadXml";
this.btnLoadXml.Size = new System.Drawing.Size(112, 23);
this.btnLoadXml.TabIndex = 2;
this.btnLoadXml.Text = "Load XML";
this.btnLoadXml.Click += new System.EventHandler(this.btnLoadXml_Click);
//
// StepByStep6_28
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(448, 357);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.lbNodes,
this.btnLoadXml});
this.Name = "StepByStep6_28";
this.Text = "StepByStep6_28";
this.ResumeLayout(false);
}
开发者ID:rjgodia30,项目名称:bcit-courses,代码行数:38,代码来源:StepByStep6_28.cs
示例11: dealAndDisplay
//deals the deck to the players
public void dealAndDisplay(ListBox player1,ListBox player2,ListBox player3,ListBox player4)
{
hands = new Hand[numPlayers];
//initialises hand array get null exception error without it
for (int i = 0; i < numPlayers; i++)
{
hands[i] = new Hand();
}
int count=0;
for (int i = 0; i < handSize; i++)
{
for (int j = 0; j < numPlayers; j++)
{
hands[j].Cards[i] = deck[count];
count++;
}
}
hands[0].displayHand(player1);
hands[1].displayHand(player2);
hands[2].displayHand(player3);
hands[3].displayHand(player4);
}
开发者ID:gregfield,项目名称:IN710-fielgm2,代码行数:26,代码来源:Deck.cs
示例12: AddNewListBox
public ListBox AddNewListBox()
{
ListBox newListBox = new
ListBox();
//add to the collection list
this.List.Add(newListBox);
//add to the overall form controls
Hatchu.Controls.Add(newListBox);
newListBox.Top = 69 + levelCount * 170;
newListBox.Width = 95;
newListBox.Left = miniCount * (newListBox.Width + 10) + 80;
newListBox.Tag = this.Count;
newListBox.Text = "";
miniCount++;
if (Count % 6 == 0)
{
miniCount = 0;
levelCount++;
}
newListBox.KeyDown += new System.Windows.Forms.KeyEventHandler(KeyDownHandler);
return newListBox;
}
开发者ID:Harmonickey,项目名称:AlexCSPortfolio,代码行数:29,代码来源:CastListBoxArray.cs
示例13: EditValue
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
if (context != null && provider != null)
{
edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc != null)
{
lb = new ListBox();
lb.Items.AddRange(new object[] {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"});
lb.SelectedIndexChanged += new System.EventHandler(lb_SelectedIndexChanged);
edSvc.DropDownControl(lb);
}
return text;
}
return base.EditValue(context, provider, value);
}
开发者ID:harpreetoxyent,项目名称:pnl,代码行数:25,代码来源:EIBSchedular.cs
示例14: AutoCompleteTextbox
/// <summary>
/// Constructor
/// </summary>
public AutoCompleteTextbox()
: base()
{
entireList = new List<string>();
matchingList = new List<string>();
lboxSuggestions = new ListBox();
lboxSuggestions.Name = "SuggestionListBox";
lboxSuggestions.Font = this.Font;
lboxSuggestions.Visible = true;
lboxSuggestions.Dock = DockStyle.Fill;// make the listbox fill the panel
lboxSuggestions.SelectionMode = SelectionMode.One;
lboxSuggestions.KeyDown += new KeyEventHandler(listBox_KeyDown);
lboxSuggestions.MouseClick += new MouseEventHandler(listBox_MouseClick);
lboxSuggestions.DataSource = matchingList;// Bind matchingList as DataSource to the listbox
this.GotFocus += new EventHandler(AutoCompleteTextbox_GotFocus);
//Will hold listbox
panel = new Panel();
panel.Visible = false;
panel.Font = this.Font;
panel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
panel.ClientSize = new System.Drawing.Size(1, 1);
panel.Name = "SuggestionPanel";
panel.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
panel.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
panel.Text = "";
panel.PerformLayout();
if (!panel.Controls.Contains(lboxSuggestions)) { this.panel.Controls.Add(lboxSuggestions); }
}
开发者ID:fmorel90,项目名称:app-domain,代码行数:34,代码来源:AutoCompleteTextBox.cs
示例15: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.listBox1 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 32);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(208, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Call \"HelloWorld\" on remote object";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// listBox1
//
this.listBox1.Location = new System.Drawing.Point(32, 72);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(224, 95);
this.listBox1.TabIndex = 1;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.listBox1,
this.button1});
this.Name = "Form1";
this.Text = "RemoteObject";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
开发者ID:emtees,项目名称:old-code,代码行数:39,代码来源:Form1.cs
示例16: getAllAttrs
public int getAllAttrs(ListBox.ObjectCollection list)
{
list.Clear();
if (fcat != null) {
var attrs = fcat.GetAttributes();
if (attrs != null) {
int i=0;
foreach(var attr in attrs) {
string s=attr.Alias;
if (convert.IsString(s)) {
s+="<"+attr.ValueType+">";
string t=attr.ToString();
if (convert.IsString(t)) s+=" // "+t;
i++;
list.Add(String.Format("{0}. {1}",i,s));
}
}
}
}
return list.Count;
}
开发者ID:emm274,项目名称:fcObj,代码行数:26,代码来源:fcData.cs
示例17: EditValue
/// <summary>
/// Displays a list of available values for the specified component than sets the value.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
/// <param name="provider">A service provider object through which editing services may be obtained.</param>
/// <param name="value">An instance of the value being edited.</param>
/// <returns>The new value of the object. If the value of the object hasn't changed, this method should return the same object it was passed.</returns>
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (provider != null)
{
// This service is in charge of popping our ListBox.
_service = ((IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)));
if (_service != null && value is DropDownListProperty)
{
var property = (DropDownListProperty) value;
var list = new ListBox();
list.Click += ListBox_Click;
foreach (string item in property.Values)
{
list.Items.Add(item);
}
// Drop the list control.
_service.DropDownControl(list);
if (list.SelectedItem != null && list.SelectedIndices.Count == 1)
{
property.SelectedItem = list.SelectedItem.ToString();
value = property;
}
}
}
return value;
}
开发者ID:vairam-svs,项目名称:poshtools,代码行数:39,代码来源:DropDownListPropertyEditor.cs
示例18: ListBoxLog
public ListBoxLog(ListBox listBox, string messageFormat, int maxLinesInListbox, bool debug = true)
{
_debug = debug;
_disposed = false;
_listBox = listBox;
_messageFormat = messageFormat;
_maxEntriesInListBox = maxLinesInListbox;
_paused = false;
_canAdd = listBox.IsHandleCreated;
_listBox.SelectionMode = SelectionMode.MultiExtended;
_listBox.HandleCreated += OnHandleCreated;
_listBox.HandleDestroyed += OnHandleDestroyed;
_listBox.DrawItem += DrawItemHandler;
_listBox.KeyDown += KeyDownHandler;
MenuItem[] menuItems = new MenuItem[] { new MenuItem("Copy", new EventHandler(CopyMenuOnClickHandler)) };
_listBox.ContextMenu = new ContextMenu(menuItems);
_listBox.ContextMenu.Popup += new EventHandler(CopyMenuPopupHandler);
_listBox.DrawMode = DrawMode.OwnerDrawFixed;
}
开发者ID:Rychard,项目名称:GnomoriaEnhanced,代码行数:26,代码来源:Log.cs
示例19: AddDeleteAction
public static void AddDeleteAction(Shape shape, ref ListBox listBoxShapes, ref GroupBox groupBoxShape)
{
if (IsActionTrackingDisabled)
return;
UpdateUndoRedoValues();
actions.Add(new UndoRedo.WorkingActionDelete(shape, Editor.Shapes, ref listBoxShapes, ref groupBoxShape));
}
开发者ID:RyamBaCo,项目名称:GameEngineeringLiveEditing,代码行数:7,代码来源:ModificationObserver.cs
示例20: Continent
public Continent(ListBox displayBox, Graphics canvas, int nAnimalTypes)
{
this.displayBox = displayBox;
this.canvas = canvas;
this.nAminalTypes = nAnimalTypes;
randomGen = new Random();
}
开发者ID:gregfield,项目名称:IN710-fielgm2,代码行数:7,代码来源:Continent.cs
注:本文中的System.Windows.Forms.ListBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论