The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Is there a way to determine that the user has clicked on a cell's image?
Also, a nice thing to have would be to be able to supply some positioning information for the image as with the standard MS Label control, maybe.
Regards
Kai Iske
SHStefan Hoenig Syncfusion Team October 18, 2002 10:57 AM UTC
Hi Kay,
thanks for the suggestion. We'll add such a property.
We'll also add a ImageClicked event to make it easier to detect a click on the image.
Here is what you can do now:
[C#]
protected override void OnCellClick(GridCellClickEventArgs e)
{
GridControlBase grid = this;
Point pt = new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y);
GridStyleInfo style = grid.Model[e.RowIndex, e.ColIndex];
GridCellRendererBase renderer = grid.CellRenderers[style.CellType];
GridCellLayout layout = renderer.GetCellLayout(e.RowIndex, e.ColIndex, style);
bool clickedOnImage = (!layout.TextRectangle.Contains(pt) && layout.ClientRectangle.Contains(pt));
if (clickedOnImage)
{
MessageBox.Show(" Clicked on bitmap ");
}
else
base.OnCellClick(e);
}
[VB]
protected override void OnCellClick(GridCellClickEventArgs e)
{
Dim grid As GridControlBase = Me
Dim pt As Point = New Point(e.MouseEventArgs.X,e.MouseEventArgs.Y)
Dim style As GridStyleInfo = grid.Model(e.RowIndex,e.ColIndex)
Dim renderer As GridCellRendererBase = grid.CellRenderers(style.CellType)
Dim layout As GridCellLayout = renderer.GetCellLayout(e.RowIndex,e.ColIndex,style)
Dim s As String = ""
Dim clickedOnImage As Boolean = (Not lay.TextRectangle.Contains(pt) And lay.ClientRectangle.Contains(pt))
if (clickedOnImage)
{
MessageBox.Show(" Clicked on bitmap ")
}
else
MyBase.OnCellClick(e)
}
Stefan
KIKai IskeOctober 21, 2002 05:39 AM UTC
Thanks Stefan, that solves it for now.
Regards
Kai Iske