private void OnMouseWheel(object sender, MouseWheelEventArgs e) { if (System.Windows.Forms.Control.ModifierKeys == System.Windows.Forms.Keys.Control) { if (e.Delta > 0 && lstOutputMessages.FontSize < 24) { lstOutputMessages.FontSize = lstOutputMessages.FontSize + 1; ITextEditorSettings settings = TextEditorControl.Instance.TextCore.TextEditorSettings; settings.FontMultiplier = settings.FontMultiplier + 1; } else if (e.Delta < 0 && lstOutputMessages.FontSize > 12) { lstOutputMessages.FontSize = lstOutputMessages.FontSize - 1; ITextEditorSettings settings = TextEditorControl.Instance.TextCore.TextEditorSettings; settings.FontMultiplier = settings.FontMultiplier + 1; } e.Handled = true; } else { if (e.Delta > 0 && offset < outputWindow.Height) { OutputScrollViewer.ScrollToVerticalOffset(offset); } else if (e.Delta < 0 && offset > 0) { OutputScrollViewer.ScrollToVerticalOffset(offset--); } } }
private void Log(string message) { Dispatcher.BeginInvoke(() => { Debug.WriteLine(message); OutputTextBox.Text += "\n" + message; // Scroll to bottom OutputScrollViewer.UpdateLayout(); OutputScrollViewer.ScrollToVerticalOffset(OutputScrollViewer.ScrollableHeight); }); }
private void ShowString(string msg) { //OutputTextBlock.Text += "\r\n" + msg; TextBlock lastText = new TextBlock() { Text = msg, TextWrapping = TextWrapping.Wrap }; lastText.FontSize = 25; OutputStack.Children.Add(lastText); //Scroll to end this.Dispatcher.BeginInvoke(() => { OutputScrollViewer.ScrollToVerticalOffset(OutputScrollViewer.ScrollableHeight); }); }