GrapeCity MultiRow Windows Forms Documentation
LinkBehavior Property
Example 


Gets or sets a value that represents the behavior of a link.
Syntax
<DefaultValueAttribute()>
<SRCategoryAttribute("Behavior")>
<SRDescriptionAttribute("Indicates the underline behavior of the hyperlink.")>
Public Property LinkBehavior As LinkBehavior
Dim instance As LinkLabelCell
Dim value As LinkBehavior
 
instance.LinkBehavior = value
 
value = instance.LinkBehavior
[DefaultValue()]
[SRCategory("Behavior")]
[SRDescription("Indicates the underline behavior of the hyperlink.")]
public LinkBehavior LinkBehavior {get; set;}

Property Value

One of the System.Windows.Forms.LinkBehavior values. The default is System.Windows.Forms.LinkBehavior.SystemDefault.
Exceptions
ExceptionDescription
System.ComponentModel.InvalidEnumArgumentExceptionThe specified value is not a System.Windows.Forms.LinkBehavior value.
Remarks
Refer to the System.Windows.Forms.LinkLabel in MSDN.
Example
The following code example shows how to customize a link label cell's behavior or appearance. This code example is part of a larger example provided for the LinkLabelCell class.
private LinkLabelCell CreateAddressLinkLabelCell()
        {
            LinkLabelCell linkLabelCell = new LinkLabelCell();

            linkLabelCell.Selectable = false;

            linkLabelCell.Name = "Address";

            // Customize behavior of link label.
            linkLabelCell.LinkBehavior = LinkBehavior.HoverUnderline;

            // Customize colors when link label is in different state.
            linkLabelCell.LinkColor = Color.Blue;

            linkLabelCell.ActiveLinkColor = Color.Red;

            linkLabelCell.VisitedLinkColor = Color.Purple;

            return linkLabelCell;
        }

        void gcMultiRow1_CellClick(object sender, CellEventArgs e)
        {
            if (e.CellName == "Address")
            {
                object value = gcMultiRow1[e.RowIndex, e.CellIndex].Value;
                if (value != null)
                {
                    Process.Start(value.ToString());
                }
            }
        }
Private Function CreateAddressLinkLabelCell() As LinkLabelCell
        Dim linkLabelCell As New LinkLabelCell()

        linkLabelCell.Selectable = False

        linkLabelCell.Name = "Address"

        ' Customize behavior of link label.
        linkLabelCell.LinkBehavior = LinkBehavior.HoverUnderline

        ' Customize colors when link label has a different status.
        linkLabelCell.LinkColor = Color.Blue

        linkLabelCell.ActiveLinkColor = Color.Red

        linkLabelCell.VisitedLinkColor = Color.Purple

        Return linkLabelCell
    End Function

    Private Sub gcMultiRow1_CellClick(ByVal sender As Object, ByVal e As CellEventArgs) Handles 
gcMultiRow1.CellClick
        If e.CellName = "Address" Then
            Dim value As Object = gcMultiRow1(e.RowIndex, e.CellIndex).Value
            If value <> Nothing Then
                Process.Start(value.ToString())
            End If
        End If
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

LinkLabelCell Class
LinkLabelCell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.