共用方式為


AnnotationStore.StoreContentChanged 事件

定義

發生於在存放區中加入或刪除 Annotation 時。

public:
 event System::Windows::Annotations::Storage::StoreContentChangedEventHandler ^ StoreContentChanged;
public event System.Windows.Annotations.Storage.StoreContentChangedEventHandler StoreContentChanged;
member this.StoreContentChanged : System.Windows.Annotations.Storage.StoreContentChangedEventHandler 
Public Custom Event StoreContentChanged As StoreContentChangedEventHandler 
Public Event StoreContentChanged As StoreContentChangedEventHandler 

事件類型

範例

下列範例示範如何為 StoreContentChanged 事件新增事件委派。

// Enable Annotations
_annotationBuffer = new MemoryStream();
_annStore = new XmlStreamStore(_annotationBuffer);
_annServ  = new AnnotationService(FDPV);
_annStore.StoreContentChanged +=
    new StoreContentChangedEventHandler(_annStore_StoreContentChanged);
_annServ.Enable(_annStore);

下列範例顯示事件委派的 StoreContentChanged 作業。

// ------------------ _annStore_StoreContentChanged -------------------
void _annStore_StoreContentChanged(object sender, StoreContentChangedEventArgs e)
{
    if (e.Action == StoreContentAction.Deleted) return;
    Annotation ann = e.Annotation;
    if (ann.Cargos.Count > 0)
    {
        AnnotationResource annResource = ann.Cargos[0] as AnnotationResource;
        if (annResource.Name == "Highlight")
            AddBookmarkOrComment(BookmarkList, ann);
        else
            AddBookmarkOrComment(CommentsList, ann);
    }
    else
    {
        AddBookmarkOrComment(CommentsList, ann);
    }
}

適用於

另請參閱