You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.8 KiB
C#
91 lines
2.8 KiB
C#
using JwKdsV.Core;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace JwKdsV.Component
|
|
{
|
|
public class NormalTextBox : DevComponents.DotNetBar.Controls.TextBoxX
|
|
{
|
|
private const int WM_RBUTTONDOWN = 0x0204;
|
|
|
|
protected override void WndProc(ref Message m)
|
|
{
|
|
//if (m.Msg == 0x0302) //0x0302是粘贴消息
|
|
//{
|
|
// m.Result = IntPtr.Zero; //拦截此消息
|
|
// return;
|
|
//}
|
|
|
|
if (m.Msg == WM_RBUTTONDOWN)
|
|
return;//WM_RBUTTONDOWN是为了不让出现鼠标菜单
|
|
base.WndProc(ref m);
|
|
}
|
|
|
|
public delegate void EventHandler(object sender, EnterEventArg e);
|
|
public event EventHandler OnEnterClick;
|
|
|
|
protected override void OnKeyDown(KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
if (OnEnterClick != null)
|
|
{
|
|
OnEnterClick(this, new EnterEventArg(this.Text.Trim()));
|
|
}
|
|
}
|
|
|
|
base.OnKeyDown(e);
|
|
}
|
|
|
|
|
|
private KeyboardType _keyboardType = KeyboardType.英文;
|
|
|
|
public KeyboardType Keyboard
|
|
{
|
|
get
|
|
{
|
|
return this._keyboardType;
|
|
}
|
|
set
|
|
{
|
|
this._keyboardType = value;
|
|
}
|
|
}
|
|
|
|
protected override void OnClick(EventArgs e)
|
|
{
|
|
base.OnClick(e);
|
|
if (!Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_ENABLESOFTKEYBOARD, true))
|
|
{
|
|
try
|
|
{
|
|
|
|
KeyboardType keyboardType = KeyboardType.中文;
|
|
var keyboard = Application.OpenForms["VirtualKeyboard"];
|
|
if (keyboard == null)
|
|
{
|
|
keyboard = new VirtualKeyboard(keyboardType);
|
|
|
|
((VirtualKeyboard)keyboard).ShowVirtualKeyboard(this, keyboardType);
|
|
keyboard.Location = new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / 2) - (keyboard.Width / 2), System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - keyboard.Height);
|
|
}
|
|
else if (keyboard.Visible != true)
|
|
{
|
|
((VirtualKeyboard)keyboard).ShowVirtualKeyboard(this, keyboardType);
|
|
keyboard.Location = new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / 2) - (keyboard.Width / 2), System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - keyboard.Height);
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|