Skip to content

Commit

Permalink
防止TimeTextBox中的文本被选中
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Nov 5, 2023
1 parent 243b059 commit 6f724a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ZongziTEK_Blackboard_Sticker/Resources/TimeTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public TimeTextBox()
{
PreviewTextInput += TimeTextBox_PreviewTextInput;
TextChanged += TimeTextBox_TextChanged;
TextAlignment = System.Windows.TextAlignment.Center;
PreviewMouseUp += TimeTextBox_PreviewMouseUp;
TextAlignment = System.Windows.TextAlignment.Center;
}

private void TimeTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
Expand Down Expand Up @@ -111,5 +112,10 @@ private bool IsValidInput(string text)

return true;
}

private void TimeTextBox_PreviewMouseUp(object sender, MouseEventArgs e)
{
SelectionLength = 0; //防止文本被选中
}
}
}

0 comments on commit 6f724a6

Please sign in to comment.