/// <summary> /// 检索框获得焦点的响应函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtMain_GotFocus(object sender, RoutedEventArgs e) { this.BdrFunction.Style = null; Manage.ClearOrFillText(ref this.txtMain, true); CheckHidden(); }
/// <summary> /// 收起标题栏 /// </summary> private void PackUp() { if (IsInformationsInitialized) { this.BdrFunction.Style = this.FindResource("BdrFunctionStyle") as Style; Manage.ClearOrFillText(ref this.txtMain, false); MELeave.RoutedEvent = Mouse.MouseLeaveEvent; this.BdrFunction.RaiseEvent(MELeave); this.Topmost = false; } }
/// <summary> /// 设置焦点到检索框 /// </summary> private void SetFocus() { if (!NowReName) { this.BdrFunction.Style = null; CheckHidden(); Manage.ClearOrFillText(ref this.txtMain, true); if (Keyboard.FocusedElement != this.txtMain) { this.txtMain.Focus(); Animation.UniversalBeginDoubleAnimation <Border>(ref this.BdrFunction, Border.HeightProperty, 0.2, 70, this.BdrFunction.ActualHeight); Animation.UniversalBeginDoubleAnimation <Border>(ref this.BdrFunction, Border.OpacityProperty, 0.2, 1, this.BdrFunction.Opacity); } } }
/// <summary> /// 快速打开搜索后的结果 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtMain_KeyDown(object sender, KeyEventArgs e) { this.Lastkey = e.Key; //只按下了Enter if (e.Key == Key.Enter && !((e.KeyboardDevice.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)) { if (QuickStart) { SearchValue[0].refItemData.Execute(); Manage.SaveKeyword(this.txtMain.Text); this.ClearSearch(); } } //按下了Ctrl+ Enter else if (e.Key == Key.Enter && ((e.KeyboardDevice.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)) { Manage.OpenSearchWindow(this.txtMain.Text); } //按下了Ctrl+F else if (e.Key == Key.F && ((e.KeyboardDevice.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)) { SearchValue[0].refItemData.FindLocation(); Manage.SaveKeyword(this.txtMain.Text); this.ClearSearch(); } //按下了Alt+C else if (e.Key == Key.C && ((e.KeyboardDevice.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) && ((e.KeyboardDevice.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)) { this.ClearSearch(); } else if (e.Key == Key.Tab) { } else { Manage.ClearOrFillText(ref this.txtMain, false, this.KeywordTip); } }
/// <summary> /// 清空检索框 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtMain_MouseUp(object sender, MouseButtonEventArgs e) { this.BdrFunction.Style = null; Manage.ClearOrFillText(ref this.txtMain, true); }
/// <summary> /// 光标离开输入框时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtMain_MouseLeave(object sender, MouseEventArgs e) { Manage.ClearOrFillText(ref this.txtMain, false); }
/// <summary> /// 光标进入输入框时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtMain_MouseEnter(object sender, MouseEventArgs e) { Manage.ClearOrFillText(ref this.txtMain, true); }