EditPoint.ReadOnly 方法

返回一个值,该值指示任何指定范围内是否包含只读文本。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
Function ReadOnly ( _
    PointOrCount As Object _
) As Boolean
bool ReadOnly(
    Object PointOrCount
)
bool ReadOnly(
    [InAttribute] Object^ PointOrCount
)
abstract ReadOnly : 
        PointOrCount:Object -> bool 
function ReadOnly(
    PointOrCount : Object
) : boolean

参数

返回值

类型:System.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

.NET Framework 安全性

请参见

参考

EditPoint 接口

EnvDTE 命名空间