class WindowsManageFrm : Form
{
System.Windows.Forms.ListBox listBox1 = null;
System.Windows.Forms.ListBox listBox2 = null;
void init()
{
this.listBox1 = new System.Windows.Forms.ListBox();
this.listBox2 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
this.Controls.Add(this.listBox1);
this.Controls.Add(this.listBox2);
this.ResumeLayout(false);
this.listBox2.Items.Add("KKKKKKK");
this.listBox2.Items.Add("MMMMMMMMMMMMMMM");
this.listBox2.Items.Add("KKKKKKK");
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x0100, WM_SYSKEYDOWN = 0x0104;
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
switch (keyData.ToString())
{
case "Return" :
Console.WriteLine(this.listBox2.SelectedItem.ToString());
break;
case "Escape" :
DialogResult dialogResult = MessageBox.Show("Quit!!", "Inform",
MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (dialogResult == DialogResult.OK) Application.Exit();
break;
default:
break;
}
}
}
비고)
// 0->ID, 1->Handle, 2->Seq
string[] split = recv.id.Split('.');
'c# 언어 > 초급과정' 카테고리의 다른 글
string 배열을 add로 추가해서, 배열데이타 초기화하기 (0) | 2023.02.22 |
---|---|
프로퍼티(Property) - get, set 사용 example(handle) (0) | 2022.12.31 |
frm.ShowModal() (0) | 2022.12.08 |
csc /reference:Newtonsoft.Json.Net20.dll /out:form_2.exe form_2.cs (0) | 2022.09.14 |
c# 프로그램 종료 (0) | 2022.04.14 |