ProcessCmdKey
public partial class CHindiEdit : TextBox { private Font m_font; private int m_nSize; private string m_strText; public CHindiEdit() { m_nSize = 12; InitializeComponent(); } public int HindiFontSize { get { return m_nSize; } set { m_nSize = value; this.Font = new Font("Lucida Sans Unicode", m_nSize); } } public CHindiEdit(IContainer container) { container.Add(this); this.FontChanged += new EventHandler(HindiEdit_OnFontChanged); InitializeComponent(); } private void HindiEdit_OnFontChanged( object o, EventArgs e ) { if (m_nSize < 10) m_nSize = 10; m_font = new Font("Lucida Sans Unicode", m_nSize); this.Font = m_font; } protected override bool ProcessCmdKey(ref System.Windows.Forms.Message m, System.Windows.Forms.Keys k) { int nHCode = 0x906; bool bGot = GetHindiCode(m, k, ref nHCode ) ; if (bGot) { char chVal = (char)nHCode; string strChar = "" + chVal + ""; System.Windows.Forms.SendKeys.Send(strChar); return true; } // if not pushing Enter Key, then process the signal as usual return base.ProcessCmdKey(ref m, k); } bool GetHindiCode(Message m, Keys k, ref int nHCode ) { if (m.Msg == 256) { switch (k) { case System.Windows.Forms.Keys.A: nHCode = 0x906; break; case System.Windows.Forms.Keys.B: nHCode = 0x907; break; case System.Windows.Forms.Keys.C: nHCode = 0x908; break; case System.Windows.Forms.Keys.D: nHCode = 0x909; break; case System.Windows.Forms.Keys.E: nHCode = 0x90A; break; case System.Windows.Forms.Keys.F: nHCode = 0x90B; break; case System.Windows.Forms.Keys.G: nHCode = 0x90C; break; case System.Windows.Forms.Keys.H: nHCode = 0x90D; break; case System.Windows.Forms.Keys.I: nHCode = 0x90E; break; default: nHCode = 0x906; break; } return true; } return false ; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)