87 lines
2.3 KiB
C#
87 lines
2.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Threading;
|
|
|
|
namespace INT69DC_7C.DialogForms
|
|
{
|
|
public partial class DialogFormUserEditorKeyboard : Form
|
|
{
|
|
#region Field
|
|
private string m_RetStringValue;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public DialogFormUserEditorKeyboard(string value)
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.textBox.Text = value;
|
|
this.RetStringValue = value;
|
|
|
|
this.DefaultSetting();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public string RetStringValue
|
|
{
|
|
get { return this.m_RetStringValue; }
|
|
private set { this.m_RetStringValue = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
private void DefaultSetting()
|
|
{
|
|
this.Location = new Point(112, 210);
|
|
|
|
this.smartKeyboard.TargetInputObject = this.textBox;
|
|
this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL;
|
|
this.smartKeyboard.Show();
|
|
}
|
|
|
|
private void KeyActionEnter()
|
|
{
|
|
this.RetStringValue = this.textBox.Text;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
this.Dispose();
|
|
}
|
|
private void KeyActionEsc()
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
this.Dispose();
|
|
}
|
|
#endregion
|
|
|
|
#region Event Handler
|
|
private void textBox_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
//if (e.KeyChar == '\r')
|
|
// this.KeyActionEnter();
|
|
//else if (e.KeyChar == 27)
|
|
// this.KeyActionEsc();
|
|
}
|
|
|
|
private void smartKeyboard_OnXKeyClick(object sender, EventArgs e)
|
|
{
|
|
this.KeyActionEsc();
|
|
}
|
|
private void smartKeyboard_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
this.KeyActionEnter();
|
|
else if (e.KeyCode == Keys.Escape)
|
|
this.KeyActionEsc();
|
|
}
|
|
#endregion
|
|
}
|
|
} |