ORM 是一种设计模式还是使用了设计模式?如果使用的话,是哪个?我刚刚在维基百科上找到了一个 DP (DAO)。
我有点困惑,因为有些文章说 ORM 是 DP,而另一些文章则说它不是——而且没有人说它使用的是 DP。
我的Masked TextBox上有一个TextChanged事件,我想要在光标停留在最后时调用它的方法.
例如:
222.222.2/21
一旦用户键入"1",就会调用该事件.
XAML
<TextBox
Name="myTextBox"
ToolTip="type here"
Height="30"
Width="100"
FontSize="14"
MaxLength="12"
HorizontalContentAlignment="Right"
TextChanged="MyMethod"/>
Run Code Online (Sandbox Code Playgroud)
C#
private void MyMethod(object sender, EventArgs e){
if (myTextBox.Text.Length == myTextBox.MaxLength)
{
//how do I know if the cursor is at the end?
}
}
Run Code Online (Sandbox Code Playgroud)
解
private void MyMethod(object sender, EventArgs e){
if (myTextBox.Text.Length == myTextBox.MaxLength)
{
if(process.CaretIndex == 12)
{
//do something
}
}
}
Run Code Online (Sandbox Code Playgroud)