PeachDrawing.Win2D

Win2dLinkMap Class

The links and named places a Win2dCanvas was told about while a document was painted. A Win2D canvas draws pixels, so a link is not part of the picture: the host asks this map what is under the pointer and, when the user clicks, activates it.

public sealed class Win2dLinkMap

Inheritance System.Object → Win2dLinkMap

Remarks

Positions are in the canvas’s layout units. A host working in device-independent pixels divides by the canvas’s PixelsPerPoint (see HitTestDips(double, double)). The map holds no native resources and outlives its canvas, so a host can hit-test after the painting callback has returned. Nothing is ever launched while a document is painted, only when TryActivateAsync(double, double) is called.

Properties  
Destinations The named places, and how far below the top of the page each is, in layout units.
Links The links, in the order they were added; a later link is on top.
Methods  
ActivateAsync(Win2dLink) Follows link: an address is opened with the system’s handler for its scheme (if the scheme is allowed and the handler is not cancelled); a link to a place in the document only raises LinkActivating and leaves the scrolling to the host.
HitTest(double, double) The topmost link at x, y in layout units, or null.
HitTestDips(double, double) Like HitTest(double, double), for a position in device-independent pixels (a pointer position in the host’s coordinates).
TryActivateAsync(double, double) Follows the topmost link at the position, if there is one (layout units).
TryGetDestination(string, double) How far below the top of the page the place called name is, in layout units.
Events  
LinkActivating Raised before a link is followed. Set Cancel to handle it yourself.