PowerTools MultiRow for Windows Forms 8.0J
関連付けられたブラウザでリンク表示

リンクラベル型セル(LinkLabelCell)でユーザーがクリックしたときにURLを関連付けられたブラウザで開くには、GcMultiRow.CellContentClickイベントを使用します。
サンプルコード
Imports System.Diagnostics
Imports GrapeCity.Win.MultiRow

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim LinkLabelCell1 As New LinkLabelCell()
    LinkLabelCell1.Name = "LinkLabelCell1"
    LinkLabelCell1.Value = "http://www.grapecity.com"
    GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {LinkLabelCell1})
End Sub

Private Sub GcMultiRow1_CellContentClick(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellEventArgs) Handles GcMultiRow1.CellContentClick
    Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow)
    Dim currentCell As Cell = gcMultiRow.Rows(e.RowIndex).Cells(e.CellIndex)

    If TypeOf currentCell Is LabelCell Then
        If e.CellName = "LinkLabelCell1" Then
            If currentCell.Enabled = True Then
                Dim command As String = currentCell.Value.ToString()
                Process.Start(command)
            End If
        End If
    End If
End Sub
using System.Diagnostics;
using GrapeCity.Win.MultiRow;

private void Form1_Load(object sender, EventArgs e)
 {
     LinkLabelCell linkLabelCell1 = new LinkLabelCell();
     linkLabelCell1.Name = "linkLabelCell1";
     linkLabelCell1.Value = "http://www.grapecity.com";
     gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { linkLabelCell1 });
}

private void gcMultiRow1_CellContentClick(object sender, CellEventArgs e)
{
    GcMultiRow gcMultiRow = sender as GcMultiRow;
    Cell currentCell = gcMultiRow.Rows[e.RowIndex].Cells[e.CellIndex];
    
    if (currentCell is LinkLabelCell)
    {
        if (e.CellName == "linkLabelCell1")
        {
            if (currentCell.Enabled == true)
            {
                string command = currentCell.Value.ToString();
                Process.Start(command);
            }
        }
    }
}

   
参照

 

 


© 2008-2015 GrapeCity inc. All rights reserved.