語言

AnnotationHelper.CreateTextStickyNoteForSelection 方法

定義

在與指定 AnnotationService的檢視器控制項目前選擇上建立文字便貼註解。

public:
 static System::Windows::Annotations::Annotation ^ CreateTextStickyNoteForSelection(System::Windows::Annotations::AnnotationService ^ service, System::String ^ author);
public static System.Windows.Annotations.Annotation CreateTextStickyNoteForSelection(System.Windows.Annotations.AnnotationService service, string author);
static member CreateTextStickyNoteForSelection : System.Windows.Annotations.AnnotationService * string -> System.Windows.Annotations.Annotation
Public Shared Function CreateTextStickyNoteForSelection (service As AnnotationService, author As String) As Annotation

參數

service
AnnotationService

用於建立文字便利貼註解的註解服務。

author
String

註解作者。

傳回

文字便條註解;或 null,若沒有選取內容可註解。

例外狀況

service 是 null。

service 未啟用。

觀看者控制不包含內容選擇。

備註

文字便利貼註解錨定於由建構子目前選擇 DocumentViewerBase的 、 DocumentViewer、 FlowDocumentPageViewer、 FlowDocumentScrollViewer或 FlowDocumentReader 控制項所定義 AnnotationService 的內容。

若沒有使用者選擇的內容(選取長度為零),則不會產生註解並拋出 a InvalidOperationException 。

author 可以指定為, null 此時不定義作者。

該註解service必須在呼叫 AnnotationService.Enable之前透過呼叫 來CreateTextStickyNoteForSelection啟用。

適用於

另請參閱