public ExpressionTextBox(ISharedViewState sharedViewState, IAutocompleteProvider autocompleteProvider) { _sharedViewState = sharedViewState; _autocompleteProvider = autocompleteProvider; KeyPress += ExpressionTextBox_KeyPress; _autocompleteMenu = new AutocompleteMenu.AutocompleteMenu(_sharedViewState); _autocompleteMenu.SetAutocompleteMenu(this, _autocompleteMenu); GotFocus += ExpressionTextBox_GotFocus; MouseDoubleClick += Control_MouseDoubleClick; SetFont(Settings.Default.ExpressionFont); SizeChanged += (o, e) => { _autocompleteMenu.MaximumSize = new Size(Size.Width, _autocompleteMenu.MaximumSize.Height); }; Settings.Default.PropertyChanged += (o, e) => { switch (e.PropertyName) { case nameof(Settings.Default.FunctionsOrder): RefreshAutoComplete(); break; case nameof(Settings.Default.ExpressionFont): SetFont(Settings.Default.ExpressionFont); break; } }; if (!DesignMode) { RefreshAutoComplete(); _sharedViewState.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(SharedViewState.IsExponent)) { _showCaret(); } }; } }