.
This commit is contained in:
55
SubProject/FCOMMON/fLovDateList.cs
Normal file
55
SubProject/FCOMMON/fLovDateList.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public partial class fLovDateList : Form
|
||||
{
|
||||
public string selectedDate = string.Empty;
|
||||
public fLovDateList(List<string> dateList)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.KeyPreview = true;
|
||||
this.KeyDown += fLovDateList_KeyDown;
|
||||
|
||||
this.listBox1.Items.Clear();
|
||||
foreach (var dateStr in dateList)
|
||||
this.listBox1.Items.Add(dateStr);
|
||||
}
|
||||
private void __Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
void fLovDateList_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape) this.Close();
|
||||
}
|
||||
void selectItem()
|
||||
{
|
||||
selectedDate = string.Empty;
|
||||
if (listBox1.Items.Count < 1) DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
if (listBox1.SelectedItem == null) DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.selectedDate = listBox1.SelectedItem.ToString();
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
|
||||
private void listBox1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
selectItem();
|
||||
}
|
||||
|
||||
private void listBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
selectItem();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user