private void logView_MeasurePreviewHeight(object sender, RowHeightEventArgs e) { using (RichTextEditViewInfo vi = new RichTextEditViewInfo(emailLogRenderer.Value)) { var view = ((GridView)sender); var email = (AdReminderEmail)view.GetRow(e.RowHandle); vi.LoadText(email.EmailSource); e.RowHeight = vi.CalcHeight(((GridViewInfo)view.GetViewInfo()).CalcRowPreviewWidth(e.RowHandle) - 1) + 2; } }
private void logView_CustomDrawRowPreview(object sender, RowObjectCustomDrawEventArgs e) { using (RichTextEditViewInfo vi = new RichTextEditViewInfo(emailLogRenderer.Value)) { var view = ((GridView)sender); var email = (AdReminderEmail)view.GetRow(e.RowHandle); vi.LoadText(email.EmailSource); vi.UpdatePaintAppearance(); vi.CalcViewInfo(e.Graphics, MouseButtons.None, Point.Empty, e.Bounds); RichTextEditPainter.DrawRTF(vi, e.Cache); } e.Handled = true; }
/// <summary>Calculates the size of the rich text.</summary> /// <param name="graphics">The graphics.</param> /// <param name="text">The text.</param> /// <param name="maxSize">The maximum size.</param> /// <param name="itemViewInfo">The item view information.</param> /// <returns>A <see cref="Size" />.</returns> public Size CalcRichTextSize(Graphics graphics, string text, Size maxSize, RichToolTipItemViewInfo itemViewInfo) { const int delta = 20; var vi = new RichTextEditViewInfo(richTextRepoItem); vi.LoadText(text); var viewer = vi.GetViewer(); var height = viewer.GetEditorHeight(graphics, maxSize.Width, maxSize.Height, 1.0f); var width = maxSize.Width; while (height < maxSize.Height && width > delta && viewer.GetEditorHeight(graphics, width - delta, maxSize.Height, 1.0f) == height) { width -= delta; } return(new Size(width + delta, height)); }
private static void UpdateRichTextEditViewInfo(Graphics graphics, string rtfText, RichTextEditViewInfo vi, Rectangle bounds) { vi.LoadText(rtfText); vi.Bounds = bounds; vi.CalcViewInfo(graphics); }