|
this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Name"
&& e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record)
{
Record record = e.TableCellIdentity.DisplayElement.GetRecord();
//Set the comment text, comment image and fore color.
e.Style.CommentTip.CommentText = e.Style.Text;
var value = record.GetValue("Image");
Icon icon = this.BytesToIcon((value as Byte[]));
e.Style.CommentTip.CommentImage = icon.ToBitmap();
e.Style.CommentTip.ForeColor = Color.Red;
}
} |
|
this.gridGroupingControl1.TableControl.CommentTipShown += TableControl_CommentTipShown;
void TableControl_CommentTipShown(object sender, CommentTipShownEventArgs e)
{
if (e.CommentTipWindow.Controls.Count > 0)
{
//Clear the default control(label)
e.CommentTipWindow.Controls.Clear();
}
//Label to show the text at top of the CommentTip window
Label lbl = new Label();
lbl.Dock = DockStyle.Top;
lbl.Text = e.Style.CommentTip.CommentText;
e.CommentTipWindow.Controls.Add(lbl);
//Picture box to show the image.
PictureBox picBox = new PictureBox();
picBox.Dock = DockStyle.Bottom;
picBox.BringToFront();
picBox.Image = e.Style.CommentTip.CommentImage;
picBox.SizeMode = PictureBoxSizeMode.StretchImage;
e.CommentTipWindow.Controls.Add(picBox);
e.CommentTipWindow.Size = new Size(150, 80);
} |