/// <Summary>
/// Reload the processcmdkey event
/// </Summary>
/// <Param name = "MSG"> </param>
/// <Param name = "keydata"> </param>
/// <Returns> </returns>
Protected override bool processcmdkey (ref message MSG, keys keydata)
{
Int Index = dgvbaseslist. currentcell. rowindex;
String text = clipboard. gettext ();
Eventargs E = new eventargs ();
If (keydata = keys. Enter)
{
This. btnok_click (this, e );
}
Else if (keydata = keys. down)
{
If (index <dgvbaseslist. Rows. Count-1)
{
// Dgvbaseslist. Rows [index + 1]. Selected = true;
Dgvbaseslist. currentcell = dgvbaseslist [0, index + 1];
Txtno. Text = (dgvbaseslist. currentrow. index + 1). tostring ();
}
}
Else if (keydata = keys. UP)
{
If (index> 0)
{
Dgvbaseslist. currentcell = dgvbaseslist [0, index-1];
Txtno. Text = (dgvbaseslist. currentrow. index + 1). tostring ();
}
}
Else if (keydata> = keys. D0 & keydata <= keys. D9) | (keydata> = keys. numpad0 & keydata <= keys. numpad9 ))
{
String num = keycodetostr (keydata );
String num1 = num;
Int NO = int32.parse (txtno. Text. tostring () + num );
If (NO> dgvbaseslist. Rows. Count-1)
{
If (int32.parse (Num)> dgvbaseslist. Rows. Count)
{
Dgvbaseslist. currentcell = dgvbaseslist [0, dgvbaseslist. Rows. Count-1];
Txtno. Text = (dgvbaseslist. Rows. Count-1). tostring ();
}
Else if (int32.parse (Num)> 0)
{
Dgvbaseslist. currentcell = dgvbaseslist [0, int32.parse (Num)-1];
Txtno. Text = num. tostring ();
}
}
Else
{
Dgvbaseslist. currentcell = dgvbaseslist [0, no-1];
Txtno. Text = No. tostring ();
}
}
Return true;
}
[Dllimport ("user32.dll")]
Static extern int mapvirtualkey (uint ucode, uint umaptype );
Private Static char keycodetochar (Keys K)
{
Int nonvirtualkey = mapvirtualkey (uint) K, 2 );
Char mappedchar = convert. tochar (nonvirtualkey );
Return mappedchar;
}
Public static string keycodetostr (Keys K)
{
Char mappedchar = keycodetochar (k );
String STR = mappedchar. tostring ();
If (char. iswhitespace (mappedchar) | string. isnullorempty (STR) | mappedchar = '\ R' | mappedchar =' \ n' | mappedchar = keycodetochar (keys. f1 ))
{
Return K. tostring ();
}
Else
{
Return STR + "";
}
}