PowerTools CalendarGrid for Windows Forms 1.0J
LinkColor プロパティ
使用例 

アクティブでない未表示のリンクの表示に使用する色を取得または設定します。
構文
Public Property LinkColor As Color
public Color LinkColor {get; set;}

プロパティ値

リンクの初期表示に使用する色を表す System.Drawing.Color。既定値は、ユーザーの Internet Explorer で設定されているリンクの色です。
解説
MSDNの System.Windows.Forms.LinkLabel を参照してください。
使用例
次のサンプルコードは、LinkLabel 型セルの動作または外観をカスタマイズする方法を示します。このサンプルコードは、CalendarLinkLabelCellType クラスに示されている詳細なコード例の一部を抜粋したものです。
private CalendarLinkLabelCellType CreateAddressLinkLabelCell()
{
    CalendarLinkLabelCellType linkLabelCell = new CalendarLinkLabelCellType();

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

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

    linkLabelCell.ActiveLinkColor = Color.Red;

    linkLabelCell.VisitedLinkColor = Color.Purple;

    return linkLabelCell;
}

void gcCalendarGrid1_CellClick(object sender, CalendarCellEventArgs e)
{
    if (e.CellPosition.Name == "Address")
    {
        CalendarCell cell = gcCalendarGrid1[e.CellPosition.Date][e.CellPosition.RowIndex, e.CellPosition.ColumnIndex];
        if (cell.CellType is CalendarLinkLabelCellType)
        {
            object link = (cell.CellType as CalendarLinkLabelCellType).Text;
            if (link != null)
            {
                Process.Start(link.ToString());
            }
        }
    }
    gcCalendarGrid1.LayoutSettings.PerformHorizontalAutoFit(0);
}
Private Function CreateAddressLinkLabelCell() As CalendarLinkLabelCellType
    Dim linkLabelCell As New CalendarLinkLabelCellType()

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

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

    linkLabelCell.ActiveLinkColor = Color.Red

    linkLabelCell.VisitedLinkColor = Color.Purple

    Return linkLabelCell
End Function

Private Sub gcCalendarGrid1_CellClick(sender As Object, e As CalendarCellEventArgs)
    If e.CellPosition.Name = "Address" Then
        Dim cell As CalendarCell = gcCalendarGrid1(e.CellPosition.[Date])(e.CellPosition.RowIndex, e.CellPosition.ColumnIndex)
        If TypeOf cell.CellType Is CalendarLinkLabelCellType Then
            Dim link As Object = TryCast(cell.CellType, CalendarLinkLabelCellType).Text
            If link IsNot Nothing Then
                Process.Start(link.ToString())
            End If
        End If
    End If
    gcCalendarGrid1.LayoutSettings.PerformHorizontalAutoFit(0)
End Sub
参照

CalendarLinkLabelCellType クラス
CalendarLinkLabelCellType メンバ
ActiveLinkColor プロパティ
VisitedLinkColor プロパティ

 

 


© 2014 GrapeCity inc. All rights reserved.