ICSharpCode.TextEditor.TextArea.IsReadOnly C# (CSharp) Method

IsReadOnly() private method

private IsReadOnly ( int offset ) : bool
offset int
return bool
		internal bool IsReadOnly(int offset)
		{
			if (Document.ReadOnly) {
				return true;
			}
			if (TextEditorProperties.SupportReadOnlySegments) {
				return Document.MarkerStrategy.GetMarkers(offset).Exists(m=>m.IsReadOnly);
			} else {
				return false;
			}
		}
		

Same methods

TextArea::IsReadOnly ( int offset, int length ) : bool

Usage Example

        protected void OnDragDrop(object sender, DragEventArgs e)
        {
            Point p = _textArea.PointToClient(new Point(e.X, e.Y));

            if (e.Data.GetDataPresent(typeof(string)))
            {
                _textArea.BeginUpdate();
                _textArea.Document.UndoStack.StartUndoGroup();
                try
                {
                    int offset = _textArea.Caret.Offset;
                    if (_textArea.IsReadOnly(offset))
                    {
                        // prevent dragging text into readonly section
                        return;
                    }

                    //TODO2 drag/drop - all this:
                    //if (e.Data.GetDataPresent(typeof(Selection)))
                    //{
                    //    Selection sel = (Selection)e.Data.GetData(typeof(Selection));
                    //    if (sel.ContainsPosition(textArea.Caret.Position))
                    //    {
                    //        return;
                    //    }

                    //    if (GetDragDropEffect(e) == DragDropEffects.Move)
                    //    {
                    //        if (SelectionManager.SelectionIsReadOnly(textArea.Document, sel))
                    //        {
                    //            // prevent dragging text out of readonly section
                    //            return;
                    //        }

                    //        int len = sel.Length;
                    //        textArea.Document.Remove(sel.StartOffset, len);

                    //        if (sel.StartOffset < offset)
                    //        {
                    //            offset -= len;
                    //        }
                    //    }
                    //}

                    _textArea.SelectionManager.ClearSelection();
                    InsertString(offset, (string)e.Data.GetData(typeof(string)));
                    _textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea));
                }
                finally
                {
                    _textArea.Document.UndoStack.EndUndoGroup();
                    _textArea.EndUpdate();
                }
            }
        }
All Usage Examples Of ICSharpCode.TextEditor.TextArea::IsReadOnly