C# 以编程方式设置超链接

C# 以编程方式设置超链接,c#,datagridview,hyperlink,C#,Datagridview,Hyperlink,使用c#winforms EMP |名称|证书|日期|文件 我想设置一列,允许我单击单元格并读取超链接,如果单元格中的数据类似于D:\ms.jpg,则可以读取超链接。现在的问题是,我想将它设置为一个特定的目录,而文件名将根据其他单元格而更改。前缀将是'D:\Tim\Cert\',其余的将是其他单元格中的值,如{EMP}{(Name)}{Cert}{(DATE)}.pdf(例如'1234(Tim)\math(25-4-2016.pdf'),我知道System.Diagnostics.Process

使用c#winforms

EMP |名称|证书|日期|文件

我想设置一列,允许我单击单元格并读取超链接,如果单元格中的数据类似于D:\ms.jpg,则可以读取超链接。现在的问题是,我想将它设置为一个特定的目录,而文件名将根据其他单元格而更改。前缀将是'D:\Tim\Cert\',其余的将是其他单元格中的值,如{EMP}{(Name)}{Cert}{(DATE)}.pdf(例如'1234(Tim)\math(25-4-2016.pdf'),我知道System.Diagnostics.Process.Start(),但您可以自定义它以允许我想要的内容,还是仅用于读取变量

        private void LoadData()  
        {
//others
            for (int intCount = 0; intCount < dataGridView1.Rows.Count; intCount++)      //-----------------hyperlink
        DataGridViewCell cell = (DataGridViewCell)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];

        if (cell.ColumnIndex == this.dataGridView1.Columns["FILE"].Index)
        {
            DataGridViewLinkCell hl = (DataGridViewLinkCell)         //-----------------hyperlink
                dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
            string filepath = (string)dataGridView1.Rows[e.RowIndex].Cells[0].Value;
            System.Diagnostics.Process.Start(filepath);
        }
        else
        {
            //do nothing since the hyperlink shouldn't be in other columns
        }
         }
private void LoadData()
{
//其他
对于(int intCount=0;intCount
固定为只读变量是什么意思?Process.Start需要一个/parameter/如果这是您要问的。所谓固定变量,我的意思是如果有一个变量pic=“D:\Tim\Cert\pic.jpg”,那么我可以使用System.Diagnostics.Process.Start(图片)打开文件吗?