PowerTools MultiRow for Windows Forms 8.0J
LinkLabelCell クラス
メンバ  使用例 

ハイパーリンクを含むCellを表します。
構文
Public Class LinkLabelCell 
   Inherits LabelCell
public class LinkLabelCell : LabelCell 
使用例
次のサンプルコードは、リンクラベル型セルを使用する方法と、このセルのプロパティをカスタマイズする方法を示します。
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;

namespace GrapeCity.Win.MultiRow.SampleCode
{
    public class LinkLabelCellDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();

        public LinkLabelCellDemo()
        {
            this.Text = "LinkLabelCell Demo";
            this.Size = new Size(550, 300);

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcMultiRow1);

            this.Load += new EventHandler(Form1_Load);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // create a template with LinkLabel cell.
            TextBoxCell nameTextBox = new TextBoxCell();
            LinkLabelCell addressLinkLabelCell = CreateAddressLinkLabelCell();

            Cell[] cells = new Cell[] { nameTextBox, addressLinkLabelCell };

            Template template1 = Template.CreateGridTemplate(cells);

            this.gcMultiRow1.Template = template1;

            this.gcMultiRow1.ColumnHeaders[0][0].Value = "Name";
            this.gcMultiRow1.ColumnHeaders[0][1].Value = "Link Address";

            this.gcMultiRow1.CellClick+=new EventHandler<CellEventArgs>(gcMultiRow1_CellClick);

            this.FillValue();
        }

        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 in different status.
            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 void FillValue()
        {
            gcMultiRow1.Rows.Add("GrapeCity", "http://www.grapecity.com/Default.aspx");
            gcMultiRow1.Rows.Add("GrapeCity japan", "http://www.grapecity.com/japan/");
            gcMultiRow1.Rows.Add("GrapeCity Product Lists", "http://www.grapecity.com/japan/support/database/dotnet_productlist.htm");
            gcMultiRow1.Rows.Add("GrapeCity MultiRow5", "http://www.grapecity.com/japan/support/database/p7_395.htm");

            gcMultiRow1.ColumnHeaders[0][0].PerformHorizontalAutoFit();
            gcMultiRow1.ColumnHeaders[0][1].PerformHorizontalAutoFit();
        }

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new LinkLabelCellDemo());
        }
    }
}
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Data
Imports System.Diagnostics
Imports GrapeCity.Win.MultiRow

Public Class LinkLabelCellDemo
    Inherits Form
    Friend WithEvents gcMultiRow1 As New GcMultiRow()

    Public Sub New()
        Me.Text = "LinkLabelCell Demo"
        Me.Size = New Size(550, 300)

        ' Add MultiRow to form
        Me.gcMultiRow1.Dock = DockStyle.Fill
        Me.Controls.Add(Me.gcMultiRow1)
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        ' create a template with LinkLabel cell.
        Dim nameTextBox As New TextBoxCell()
        Dim addressLinkLabelCell As LinkLabelCell = CreateAddressLinkLabelCell()

        Dim cells As Cell() = New Cell() {nameTextBox, addressLinkLabelCell}

        Dim template1 As Template = Template.CreateGridTemplate(cells)

        Me.gcMultiRow1.Template = template1

        Me.gcMultiRow1.ColumnHeaders(0)(0).Value = "Name"
        Me.gcMultiRow1.ColumnHeaders(0)(1).Value = "Link Address"

        Me.FillValue()
    End Sub

    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 in 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

    Private Sub FillValue()
        gcMultiRow1.Rows.Add("GrapeCity", "http://www.grapecity.com/Default.aspx")
        gcMultiRow1.Rows.Add("GrapeCity japan", "http://www.grapecity.com/japan/")
        gcMultiRow1.Rows.Add("GrapeCity Product Lists", "http://www.grapecity.com/japan/support/database/dotnet_productlist.htm")
        gcMultiRow1.Rows.Add("GrapeCity MultiRow5", "http://www.grapecity.com/japan/support/database/p7_395.htm")

        gcMultiRow1.ColumnHeaders(0)(0).PerformHorizontalAutoFit()
        gcMultiRow1.ColumnHeaders(0)(1).PerformHorizontalAutoFit()
    End Sub

    <STAThreadAttribute()> _
    Public Shared Sub Main()
        Application.EnableVisualStyles()
        Application.Run(New LinkLabelCellDemo())
    End Sub
End Class
継承階層

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         GrapeCity.Win.MultiRow.Cell
            GrapeCity.Win.MultiRow.LabelCell
               GrapeCity.Win.MultiRow.LinkLabelCell

参照

LinkLabelCell メンバ
GrapeCity.Win.MultiRow 名前空間
LabelCell クラス

 

 


© 2008-2015 GrapeCity inc. All rights reserved.