EditPoint2.ReadOnly(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个值,该值指示任何指定范围内是否包含只读文本。
public:
bool ReadOnly(System::Object ^ PointOrCount);
public:
bool ReadOnly(Platform::Object ^ PointOrCount);
bool ReadOnly(winrt::Windows::Foundation::IInspectable const & PointOrCount);
[System.Runtime.InteropServices.DispId(139)]
public bool ReadOnly (object PointOrCount);
[<System.Runtime.InteropServices.DispId(139)>]
abstract member ReadOnly : obj -> bool
Public Function ReadOnly (PointOrCount As Object) As Boolean
参数
返回
如果选定内容中包含只读文本,则为 true;否则为 false。
实现
- 属性
示例
Sub ReadOnlyExample()
Dim objTextDoc As TextDocument
Dim objMovePt As EditPoint
Dim objEditPt As EditPoint, iCtr As Integer
' Create a new text file.
DTE.ItemOperations.NewFile("General\Text File")
' Get a handle to the new document and create an EditPoint.
objTextDoc = DTE.ActiveDocument.Object("TextDocument")
objEditPt = objTextDoc.StartPoint.CreateEditPoint
objMovePt = objTextDoc.EndPoint.CreateEditPoint
' Insert ten lines of text.
For iCtr = 1 To 10
objEditPt.Insert("This is a test." & Chr(13))
Next iCtr
' Move the active point to where the second edit point is
' and then insert some text.
MsgBox("Is text read-only? " & objEditPt.ReadOnly(5))
End Sub
注解
如果将整个文档标记为这样,或者如果该字符包含在只读块中,则字符可以为只读。