이 코드는 윈도우 폼 응용 프로그램 용이며 Silverlight 응용 프로그램으로 변환하려고 시도했지만 작동하지 않습니다. 거기에 텍스트 상자 및 그것에 연결된 KeyDown 이벤트 처리기. 사용자가 텍스트 상자에 포커스가있는 동안 화살표 키 (왼쪽 또는 오른쪽)를 누르면 쓰기가됩니다. 또는 -. 그것이 윈도우 폼 때 나는 e.KeyCode와 Keys.Right를 사용하고 위대한 작품이지만 실버 라이트 때 e.Key와 key.Right를 사용하고 화살표가 2 개의 함수를 움직이고 쓰기 때문에 제대로 동작하지 않는다. ./-. Silverlight에서 어떻게 처리 할 수 있습니까? 사용 사이에 큰 다른 효과가간단한 코드를 Winform에서 Silverlight 앱으로 변환하는 데 문제가 있습니다.
이private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (sender is TextBox)
{
TextBox textBox = (TextBox)sender;
if (e.Key == Key.Left || e.Key == Key.Right)
{
e.Handled = true;
char insert;
if (e.Key == Key.Left)
{ insert = '.'; }
else
{ insert = '-'; }
int i = textBox.SelectionStart;
textBox.Text = textBox.Text.Insert(i, insert.ToString());
textBox.Select(i + 1, 0);
}
}
}
이해가 안 :
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (sender is TextBox)
{
TextBox textBox = (TextBox)sender;
if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right)
{
e.Handled = true;
char insert;
if (e.KeyCode == Keys.Left)
{ insert = '.'; }
else
{ insert = '-'; }
int i = textBox.SelectionStart;
textBox.Text = textBox.Text.Insert(i, insert.ToString());
textBox.Select(i + 1, 0);
}
}
}
(실버 라이트) :
코드 (창 양식) (내 영어 좋지 않다) 키 코드/키 및 키/키 또는 다른 이유로?
이미했지만 여전히 문제 – Sara
빌어 먹을이, 나는 잠이 필요합니다/ – Femaref