共用方式為


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 命名空間