Image is not based on Control. You need to trap the click event of the
datagrid and detect which cell it's in. if it's in a cell with an image,
that's your click.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
> Hi all,
>
[quoted text clipped - 7 lines]
> Thank you for your time and help,
> Frederik
Frederik - 14 Jan 2005 15:14 GMT
Thank you very much Bob...
Thanks to your tip I found what I needed (openening a webpage when an icon
is clicked in the datagrid - the url is too long to display).
Here's my code (snippet):
private void FilmGrid_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
DataGrid.HitTestInfo hti;
hti = FilmGrid.HitTest(e.X, e.Y);
// column 0 contains an url, but is not visible (width=0)
// column 1 contains an internet explorer like icon
if (hti.Column == 1 && hti.Type == DataGrid.HitTestType.Cell)
{
// get url
string url = FilmGrid[hti.Row, 0].ToString();
// # must be removed (coming from xml file)
url = url.Substring(1, url.Length - 2);
// start default browser
System.Diagnostics.Process.Start(url);
}
}
Regards,
Frederik
> "Bob Powell [MVP]" wrote...
> Image is not based on Control. You need to trap the click event of the
> datagrid and detect which cell it's in. if it's in a cell with an image,
> that's your click.