ARCed.Scintilla.LineWrapping.WrapLines C# (CSharp) Method

WrapLines() public method

Forces the line range specified to wrap at the given pixel width. This operates independently of the current Scintilla line wrapping Mode property.
///// and do not specify a valid ///// range of lines within the document. /////
public WrapLines ( int startLine, int endLine, int width ) : void
startLine int The zero-based line index to start wrapping.
endLine int The zero-based line index to stop wrapping.
width int /// The maximum width in pixels of the lines to wrap. A value of zero resets forced line wrapping. ///
return void
        public virtual void WrapLines(int startLine, int endLine, int width)
        {
            //if (startLine < 0)
            //    throw new ArgumentOutOfRangeException("startLine", _resources.Exception_InvalidStartLine);
            //if (endLine < startLine)
            //    throw new ArgumentOutOfRangeException("endLine", _resources.Exception_InvalidLineRange);

            // Convert line indexes to positions within the line
            int startPos = this._scintilla.DirectMessage(NativeMethods.SCI_POSITIONFROMLINE, new IntPtr(startLine), IntPtr.Zero).ToInt32();
            int endPos = this._scintilla.DirectMessage(NativeMethods.SCI_POSITIONFROMLINE, new IntPtr(endLine), IntPtr.Zero).ToInt32();

            //if (startPos == -1)
            //    throw new ArgumentOutOfRangeException("startLine", string.Format(CultureInfo.InvariantCulture, _resources.Exception_InvalidLine, "start"));
            //if (endPos == -1)
            //    throw new ArgumentOutOfRangeException("endLine", string.Format(CultureInfo.InvariantCulture, _resources.Exception_InvalidLine, "end"));

            // Set the target positions (which Scintilla will convert back to line indexes)
            this._scintilla.DirectMessage(NativeMethods.SCI_SETTARGETSTART, new IntPtr(startPos), IntPtr.Zero);
            this._scintilla.DirectMessage(NativeMethods.SCI_SETTARGETEND, new IntPtr(endPos), IntPtr.Zero);

            this._scintilla.DirectMessage(NativeMethods.SCI_LINESSPLIT, new IntPtr(width), IntPtr.Zero);
        }