Your personal information is not shared or sold to anyone for any purpose, ever. ![]() We believe ensuring the security of your personal information is an important part of our business, and are committed to ensuring that your privacy is protected at all times. SOAPWORKS STUDIO has the utmost respect for your personal privacy. This is a sample of the code that loads the text into the CodeBox window: private void OnLoadDASM (object sender, RoutedEventArgs e)ĭisassemblyOutput.m_eWindowData = ĭisassemblyOutput.Background = new SolidColorBrush (Colors.Transparent) //Color.FromRgb (0xCE, 0圎9, 0xC9)) ĭisassemblyOutput.Foreground = new SolidColorBrush (Colors.Transparent) ĭisassemblyOutput.BaseBackground = new SolidColorBrush (Color.FromRgb (0xCE, 0圎9, 0xC9)) ĭisassemblyOutput.BaseForeground = new SolidColorBrush (Colors.Transparent) ĭisassemblyOutput.TextWrapping = TextWrapping.NoWrap ĭisassemblyOutput.Text += "Loop_02_0A0F 0A0F: SIO F3 10 28 5475 Keyboard Set Error Indicator Restore Data Key " + Environment.NewLine ĭisassemblyOutput.Text += " Disable Interrupt " + Environment.NewLine ĭisassemblyOutput.Text += " 0A12: SNS 70 12 FF,1 0x0B0C 5475 Keyboard 2 sense bytes " + Environment.This privacy policy explains how SOAPWORKS STUDIO gathers, uses, and protects information you provide us while visiting our web site. Xaml from the parent window that uses the CodeBox code: Int iEndVisibleLine = GetLastVisibleLineIndex () Int iStartVisibleLine = GetFirstVisibleLineIndex () ***formattedText.MaxTextWidth = this.ViewportWidth // space for scrollbar***įormattedText.MaxTextHeight = Math.Max (this.ActualHeight + this.VerticalOffset, 0) //Adjust for scrollingĭrawingContext.PushClip (new RectangleGeometry (new Rect (0, 0, this.ActualWidth, this.ActualHeight))) //restrict text to textbox Protected override void OnRender ( drawingContext)įormattedText formattedText = new FormattedText (īaseForeground) //Text that matches the textbox'sĭouble leftMargin = 4.0 + ĭouble topMargin = 2 + Void txtTest_TextChanged (object sender, TextChangedEventArgs e) New FrameworkPropertyMetadata (new SolidColorBrush (Colors.Black), FrameworkPropertyMetadataOptions.AffectsRender)) ![]() Public static DependencyProperty BaseForegroundProperty = DependencyProperty.Register ("BaseForeground", typeof (Brush), typeof (CodeBox), This.TextWrapping = īase.TextWrapping = This.Background = new SolidColorBrush (Colors.Transparent) This.Foreground = new SolidColorBrush (Colors.Transparent) This.TextChanged += new TextChangedEventHandler (txtTest_TextChanged) SolidColorBrush m_brBlack = new SolidColorBrush (Colors.Black) SolidColorBrush m_brOrange = new SolidColorBrush (Colors.Orange) SolidColorBrush m_brRed = new SolidColorBrush (Colors.Red) The rest (that has been reomved) is just code that does more text-coloring. This is the code-behind C#, lengthy, but it has been trimmed down to only enough to show what's going on. I'm fairly new to WPF and there's much to it that is still mysterious to me, so the solution may be obvious to someone with more experience with it. ![]() "formattedText.MaxTextWidth = this.ViewportWidth // space for scrollbar" ![]() I've tracked the problem to a line in OnRender: The scrollbar is visible and it changes the size of the drag button to show that it sees that the unwrapped text is wider than the viewing area, but since the text has already been wrapped, dragging it doesn't make any difference. I've tried adding a horizontal scrollbar but that doesn't help. In a normal TextBox, simply setting the TextWrapping property to NoWrap does the trick, but not with CodeBox (which inherits from TextBox in code-behind). I've used the CodeBox project from CodeProject and it works very well except for the fact that I can't disable text wrapping.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |