Int iOffset = GetCharacterIndexFromLineIndex (iIdx) Int iEndVisibleLine = GetLastVisibleLineIndex () įor (int iIdx = iStartVisibleLine iIdx <= iEndVisibleLine - 1 ++iIdx) 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) #Set default ipynb viewer code#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). ipynb Quarto will not execute the cells within the notebook by default (the presumption being that you already executed them while editing the notebook).I've used the CodeBox project from CodeProject and it works very well except for the fact that I can't disable text wrapping. See the documentation on Output Options for additional details. There are many output options available, including options to optionally hide code, warnings, and/or output. As with document front-matter, option names/values use YAML syntax. Note that options must appear at the very beginning of the cell. Here we specify the label and fig-cap options so that the plot generated from the cell can be cross-referenced. Quarto uses leading comments with a special prefix ( #|) to denote cell options. Any valid Pandoc markdown syntax can be included in markdown cells. Note that a Quarto cross-reference ( is included in the markdown. Here’s the underlying code for the markdown cell: See the documentation on Authoring and Output Formats for additional details. There are YAML options to control many other aspects of document rendering. In this example we specify that we want code to appear collapsed by default. Note that you can switch the type of a call to Raw using the notebook toolbar: The first cell of your notebook should be a Raw cell that contains the document title, author, and any other options you need to specify. Note that the target file (in this case notebook.ipynb) should always be the very first command line argument.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |