Background: I work with winforms in C #. I do not want the images displayed in the datagridview cells, I only saved the path in the database and showing them in the datagridview from the database.
Problem: When a user enters a cell, a tooltip pops up. I need so that when the column index of the current cell is 2, then the tooltip should display an image from the path specified in the current cell.
I found this article is very good. But failed to succeed. I have the following code
void CustomizedToolTip_Popup(object sender, PopupEventArgs e)
{
DataGridView parent = e.AssociatedControl as DataGridView;
if (parent.CurrentCell != null)
{
if (parent.CurrentCell.ColumnIndex == 2)
{
Bitmap bmpIn = new Bitmap(parent.CurrentCell.Value + "");
using (Graphics g = Graphics.FromImage(bmpIn))
{
Rectangle mr = new Rectangle(5, 5, 50, 50);
mr.Location = new Point(5, 5);
g.PageUnit = GraphicsUnit.Pixel;
g.DrawImage(bmpIn, mr);
}
}
}
}
, , , , , , , tootip. . datagridview.
