public MainWindow() { InitializeComponent(); TextCompositionManager.AddPreviewTextInputHandler(tbSearch, OnPreviewTextInput); TextCompositionManager.AddPreviewTextInputStartHandler(tbSearch, OnPreviewTextInputStart); TextCompositionManager.AddPreviewTextInputUpdateHandler(tbSearch, OnPreviewTextInputUpdate); }
public NumberBoxContainer() { InitializeComponent(); if (System.Windows.Application.Current.MainWindow != null) { TextCompositionManager.AddPreviewTextInputHandler(System.Windows.Application.Current.MainWindow, MainWindow_PreviewTextInput); } }
/// <summary> /// コンストラクタ /// </summary> public MainWindow() { InitializeComponent(); // GUI初期処理 TitleBase = this.Title + " " + MyUtil.GetFileVersion(); this.Title = TitleBase; TextCompositionManager.AddPreviewTextInputHandler(this, OnPreviewTextInput); TextCompositionManager.AddPreviewTextInputUpdateHandler(this, OnPreviewTextInputUpdate); }
public MainWindow() { InitializeComponent(); TextCompositionManager.AddPreviewTextInputHandler(TB, OnPreviewTextInput); TextCompositionManager.AddPreviewTextInputStartHandler(TB, OnPreviewTextInputStart); TextCompositionManager.AddPreviewTextInputUpdateHandler(TB, OnPreviewTextInputUpdate); kbd = new KeyboardDevice(); kbd.KeyboardDeviceFound += OnKeyboardDeviceFound; kbd.KeyboardDeviceConnected += OnKeyboardDeviceConnected; }
readonly PlainTextNote _ptn = new PlainTextNote(); // The enhanced note window /** Starting Process **/ /**********************/ /// The application starts by asking for tester and charter information. Only then the session starts // Default constructor, everything is empty/default values public SmWidget() { RegUtil.InitReg(); var trans = GetTransparencyFromReg(); Logger.Record("[SMWidget]: App constructor. Initializing.", "SMWidget", "info"); InitializeComponent(); SetBgColor(GetBgColorFromReg()); TransparencySlide.Value = trans; _ptn.InitializeComponent(); _ptn.Sm = this; TextCompositionManager.AddPreviewTextInputHandler(NoteContent, OnPreviewTextInput); TextCompositionManager.AddPreviewTextInputUpdateHandler(NoteContent, OnPreviewTextInputUpdate); Task.Run((Action)Updater.CheckVersion); NoteContent.Focus(); Logger.Record("[SMWidget]: App constructor initialized and CLI executed.", "SMWidget", "info"); }
public override void OnApplyTemplate() { if (_textBox != null) { TextCompositionManager.RemovePreviewTextInputHandler(_textBox, PreviewTextInputHandler); _textBox.TextChanged -= TextBox_TextChanged; _textBox.PreviewKeyDown -= TextBox_PreviewKeyDown; _textBox.LostFocus -= TextBox_LostFocus; } base.OnApplyTemplate(); _textBox = GetTemplateChild(ElementTextBox) as TextBox; _errorTip = GetTemplateChild(ElementErrorTip) as UIElement; if (_textBox != null) { _textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name) { Source = this }); #if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472) _textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name) { Source = this }); #endif _textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name) { Source = this }); _textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name) { Source = this }); TextCompositionManager.AddPreviewTextInputHandler(_textBox, PreviewTextInputHandler); _textBox.TextChanged += TextBox_TextChanged; _textBox.PreviewKeyDown += TextBox_PreviewKeyDown; _textBox.LostFocus += TextBox_LostFocus; _textBox.Text = CurrentText; } }
public override void OnApplyTemplate() { if (_textBox != null) { TextCompositionManager.RemovePreviewTextInputHandler(_textBox, PreviewTextInputHandler); _textBox.TextChanged -= _textBox_TextChanged; _textBox.PreviewKeyDown -= TextBox_PreviewKeyDown; _textBox.LostFocus -= TextBox_LostFocus; } base.OnApplyTemplate(); _textBox = GetTemplateChild(ElementTextBox) as TextBox; if (_textBox != null) { TextCompositionManager.AddPreviewTextInputHandler(_textBox, PreviewTextInputHandler); _textBox.TextChanged += _textBox_TextChanged; _textBox.PreviewKeyDown += TextBox_PreviewKeyDown; _textBox.LostFocus += TextBox_LostFocus; _textBox.Text = CurrentText; } }
public override void EnableEvent(object eventId) { if (eventId is WidgetEvent) { var ev = (WidgetEvent)eventId; switch (ev) { case WidgetEvent.KeyPressed: Widget.KeyDown += WidgetKeyDownHandler; break; case WidgetEvent.KeyReleased: Widget.KeyUp += WidgetKeyUpHandler; break; case WidgetEvent.TextInput: TextCompositionManager.AddPreviewTextInputHandler(Widget, WidgetPreviewTextInputHandler); break; case WidgetEvent.ButtonPressed: Widget.MouseDown += WidgetMouseDownHandler; break; case WidgetEvent.ButtonReleased: Widget.MouseUp += WidgetMouseUpHandler; break; case WidgetEvent.GotFocus: Widget.GotFocus += WidgetGotFocusHandler; break; case WidgetEvent.LostFocus: Widget.LostFocus += WidgetLostFocusHandler; break; case WidgetEvent.MouseEntered: Widget.MouseEnter += WidgetMouseEnteredHandler; break; case WidgetEvent.MouseExited: Widget.MouseLeave += WidgetMouseExitedHandler; break; case WidgetEvent.MouseMoved: Widget.MouseMove += WidgetMouseMoveHandler; break; case WidgetEvent.BoundsChanged: Widget.SizeChanged += WidgetOnSizeChanged; break; case WidgetEvent.MouseScrolled: Widget.MouseWheel += WidgetMouseWheelHandler; break; } if ((ev & dragDropEvents) != 0 && (enabledEvents & dragDropEvents) == 0) { // Enabling a drag&drop event for the first time Widget.DragOver += WidgetDragOverHandler; Widget.Drop += WidgetDropHandler; widget.DragLeave += WidgetDragLeaveHandler; } enabledEvents |= ev; } }
//private DockPanel layout; /// <summary> /// Create ReoGrid spreadsheet control /// </summary> public ReoGridControl() { this.SnapsToDevicePixels = true; this.Focusable = true; this.FocusVisualStyle = null; this.BeginInit(); //layout = new DockPanel(); //this.bottomGrid = new DockPanel() { Height = ScrollBarSize }; //this.bottomGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(ScrollBarWidth) }); this.sheetTab = new SheetTabControl() { ControlWidth = 400, }; this.horScrollbar = new ScrollBar() { Orientation = Orientation.Horizontal, Height = ScrollBarSize, SmallChange = Worksheet.InitDefaultColumnWidth, }; this.verScrollbar = new System.Windows.Controls.Primitives.ScrollBar() { Orientation = Orientation.Vertical, Width = ScrollBarSize, SmallChange = Worksheet.InitDefaultRowHeight, }; this.Children.Add(this.sheetTab); this.Children.Add(this.horScrollbar); Grid.SetColumn(this.horScrollbar, 1); //this.Children.Add(this.bottomGrid); this.Children.Add(this.verScrollbar); this.horScrollbar.Scroll += (s, e) => { if (this.currentWorksheet.ViewportController is IScrollableViewportController) { ((IScrollableViewportController)this.currentWorksheet.ViewportController).HorizontalScroll(e.NewValue); } }; this.verScrollbar.Scroll += (s, e) => { if (this.currentWorksheet.ViewportController is IScrollableViewportController) { ((IScrollableViewportController)this.currentWorksheet.ViewportController).VerticalScroll(e.NewValue); } }; this.sheetTab.SplitterMoving += (s, e) => { double width = System.Windows.Input.Mouse.GetPosition(this).X + 3; if (width < 75) { width = 75; } if (width > this.RenderSize.Width - ScrollBarSize) { width = this.RenderSize.Width - ScrollBarSize; } this.SheetTabWidth = width; this.UpdateSheetTabAndScrollBarsLayout(); //this.bottomGrid.ColumnDefinitions[0].Width = new GridLength(width); //double newScrollWidth = this.RenderSize.Width // - this.bottomGrid.ColumnDefinitions[0].ActualWidth - this.bottomGrid.ColumnDefinitions[2].ActualWidth; //if (newScrollWidth < 0) newScrollWidth = 0; //this.bottomGrid.ColumnDefinitions[1].Width = new GridLength(newScrollWidth); //this.horScrollbar.Width = this.bottomGrid.ColumnDefinitions[1].ActualWidth; }; this.InitControl(); this.editTextbox = new InputTextBox() { Owner = this, BorderThickness = new Thickness(0), Visibility = System.Windows.Visibility.Hidden, HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden, Padding = new Thickness(0), Margin = new Thickness(0), }; this.Children.Add(editTextbox); this.adapter = new ReoGridWPFControlAdapter(this); this.adapter.editTextbox = this.editTextbox; InitWorkbook(this.adapter); TextCompositionManager.AddPreviewTextInputHandler(this, OnTextInputStart); this.EndInit(); this.renderer = new Rendering.WPFRenderer(); Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, new Action(delegate() { if (!string.IsNullOrEmpty(this.LoadFromFile)) { var file = new System.IO.FileInfo(this.LoadFromFile); this.currentWorksheet.Load(file.FullName); } })); }