1
可能重複:
how to give hyperlink to Image Column in Datagridview超鏈接的DataGridView的列
我可以給超鏈接包含圖像的DataGridView的列..和點擊圖像後,指定的網址應打開?
可能重複:
how to give hyperlink to Image Column in Datagridview超鏈接的DataGridView的列
我可以給超鏈接包含圖像的DataGridView的列..和點擊圖像後,指定的網址應打開?
可以使用Dictionary<Image,string>
映射鏈接到圖像,然後把手上的圖像單元格單擊事件
Dictionary<Image,string> UrlDicationary = new Dictionary<Image, string>();
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if(e.ColumnIndex == your_image_column_index)
{
Image image = dataGridView1[e.ColumnIndex, e.RowIndex].Value as Image;
if(image != null)
{
string url;
if(UrlDicationary.TryGetValue(image, out url))
{
Process.Start(url);
}
}
}
}
您需要填寫字典第一
感謝它的工作... – Nitin 2011-03-03 11:37:04
你已經問過這個問題,一旦:如何讓超級鏈接在Datagridview圖像列](http://stackoverflow.com/questions/5179490/how-to-give-hyperlink-to-image-column-in-datagridview) – 2011-03-03 11:18:09
對不起,這.. – Nitin 2011-03-03 11:20:00