FrmListBoxDialog

This commit is contained in:
2020-06-19 01:50:19 +02:00
parent ea5a8a8f8d
commit 67207b15dd
3 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
namespace VAR.Toolbox.UI
{
partial class FrmListBoxDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lsbItems = new System.Windows.Forms.ListBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnAccept = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lsbItems
//
this.lsbItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lsbItems.FormattingEnabled = true;
this.lsbItems.Location = new System.Drawing.Point(12, 12);
this.lsbItems.Name = "lsbItems";
this.lsbItems.Size = new System.Drawing.Size(338, 407);
this.lsbItems.TabIndex = 0;
this.lsbItems.SelectedIndexChanged += new System.EventHandler(this.lsbItems_SelectedIndexChanged);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(275, 436);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// btnAccept
//
this.btnAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnAccept.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnAccept.Location = new System.Drawing.Point(194, 436);
this.btnAccept.Name = "btnAccept";
this.btnAccept.Size = new System.Drawing.Size(75, 23);
this.btnAccept.TabIndex = 2;
this.btnAccept.Text = "Accept";
this.btnAccept.UseVisualStyleBackColor = true;
//
// FrmListBoxDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(362, 465);
this.Controls.Add(this.btnAccept);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.lsbItems);
this.Name = "FrmListBoxDialog";
this.Text = "ListBoxDialog";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListBox lsbItems;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnAccept;
}
}

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Windows.Forms;
namespace VAR.Toolbox.UI
{
public partial class FrmListBoxDialog : Form
{
public FrmListBoxDialog()
{
InitializeComponent();
}
public string Title
{
get { return base.Text; }
set { Text = value; }
}
public void LoadItems(List<string> items)
{
lsbItems.Items.Clear();
lsbItems.Items.AddRange(items.ToArray());
}
public string Value
{
get { return (lsbItems.SelectedItem as string) ?? string.Empty; }
}
private void lsbItems_SelectedIndexChanged(object sender, System.EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
}
}

View File

@@ -138,6 +138,12 @@
<Compile Include="UI\FrmDialogString.Designer.cs">
<DependentUpon>FrmDialogString.cs</DependentUpon>
</Compile>
<Compile Include="UI\FrmListBoxDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\FrmListBoxDialog.Designer.cs">
<DependentUpon>FrmListBoxDialog.cs</DependentUpon>
</Compile>
<Compile Include="UI\IToolPanel.cs" />
<Compile Include="UI\Tools\FrmCoder.cs">
<SubType>Form</SubType>