LinkLabelCell をクリックしたときに関連付けられているブラウザでリンクを開く方法
対象製品
MultiRow for Windows Forms 5.0J
詳細
LinkLabelCell のクリック操作に対応するイベントを GcMultiRow.CellContentClick イベントに記述し、セルの値に設定されているリンクを Process.Start メソッドで開きます。
[Visual Basic]
[C#]
[Visual Basic]
Imports System.Diagnostics
Imports GrapeCity.Win.MultiRow
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 clickedCell As Cell = gcMultiRow.Rows(e.RowIndex).Cells(e.CellIndex)
If TypeOf clickedCell Is LinkLabelCell Then
If clickedCell.Enabled = True Then
If Not clickedCell.Value Is Nothing Then
Process.Start(clickedCell.Value.ToString())
End If
End If
End If
End Sub
Imports GrapeCity.Win.MultiRow
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 clickedCell As Cell = gcMultiRow.Rows(e.RowIndex).Cells(e.CellIndex)
If TypeOf clickedCell Is LinkLabelCell Then
If clickedCell.Enabled = True Then
If Not clickedCell.Value Is Nothing Then
Process.Start(clickedCell.Value.ToString())
End If
End If
End If
End Sub
[C#]
using System.Diagnostics;
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_CellContentClick(object sender, CellEventArgs e)
{
GcMultiRow gcMultiRow = sender as GcMultiRow;
Cell clickedCell = gcMultiRow.Rows[e.RowIndex].Cells[e.CellIndex];
if (clickedCell is LinkLabelCell)
{
if (clickedCell.Enabled)
{
if (clickedCell.Value != null)
{
Process.Start(clickedCell.Value.ToString());
}
}
}
}
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_CellContentClick(object sender, CellEventArgs e)
{
GcMultiRow gcMultiRow = sender as GcMultiRow;
Cell clickedCell = gcMultiRow.Rows[e.RowIndex].Cells[e.CellIndex];
if (clickedCell is LinkLabelCell)
{
if (clickedCell.Enabled)
{
if (clickedCell.Value != null)
{
Process.Start(clickedCell.Value.ToString());
}
}
}
}
この文書は、以前は次のFAQ IDで公開されていました : 11369