ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1PrintDocument > Anchors and Hyperlinks > Adding a Hyperlink to a Location Within the Current Document

Adding a Hyperlink to a Location Within the Current Document

You can add a link to an object within the current document without creating an anchor. Instead, you can use the C1LinkTargetDocumentLocation link target created directly on a render object, like this, where ro1 is an arbitrary render object in the current document:

      Visual Basic

Dim linkTarget = New C1.C1Preview.C1LinkTargetDocumentLocation(ro1)

      C#

C1LinkTarget linkTarget = new C1LinkTargetDocumentLocation(ro1);

Setting this link target on a hyperlink will make that hyperlink jump to the specified render object when the object owning the hyperlink is clicked. If, for example, ro2 is a render object that you want to turn into a hyperlink, the following code will link it to the location of ro1 on which the linkTarget was created as shown in the code snippet above:

      Visual Basic

rt2.Hyperlink = New C1.C1Preview.C1Hyperlink()

rt2.Hyperlink.LinkTarget = linkTarget

      C#

rt2.Hyperlink = new C1Hyperlink();

rt2.Hyperlink.LinkTarget = linkTarget;

Note that in this example, the LinkTarget property of the hyperlink was set after the hyperlink has been created.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.