如何在Ultra Win Grid单元格中显示富文本格式化文本(infragistics)。我将这些数据作为varbinary(MAX)存储在数据库中。
答案 0 :(得分:1)
使用Infragistics,您有很多选择如何实现此功能。 让我告诉你最简单的方法:
UltraGridColumn c = null;
/// initialize c here. Lets suppose that it has a "rtf" key.
c.Style = ColumnStyle.FormattedTextEditor;
((FormattedLinkEditor) c.Editor).UnderlineLinks = UnderlineLink.Always;
((FormattedLinkEditor)c.Editor).LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(rtfColumnn_LinkClicked);
c.MaskClipMode = MaskMode.Raw;
((FormattedLinkEditor) c.Editor).TreatValueAs = TreatValueAs.FormattedText;
private void rtfColumnn_LinkClicked(object sender, Infragistics.Win.FormattedLinkLabel.LinkClickedEventArgs e)
{
e.OpenLink = true;
}
bindingGrid.BeforeEnterEditMode += this.Grid_BeforeEnterEditMode;
private void Grid_BeforeEnterEditMode(object sender, System.ComponentModel.CancelEventArgs e)
{
if (Grid.ActiveCell.Column.Key=="rtf")
{
Infragistics.Win.SupportDialogs.FormattedTextEditor.FormattedTextUIEditorForm rtf_frm =
new FormattedTextUIEditorForm();
rtf_frm.Value = Grid.ActiveCell.Value;
DialogResult dresult = rtf_frm.ShowDialog();
if (dresult == DialogResult.OK)
{
Grid.ActiveCell.Value = rtf_frm.Value;
}
e.Cancel = true;
return;
}
}