public int CalcHeight(DevExpress.Utils.Drawing.GraphicsCache cache, int width) { RepositoryItemMyButtonEdit ri = (Item as RepositoryItemMyButtonEdit); RichTextEditViewInfo vi = new RichTextEditViewInfo(ri.RichEdit); vi.EditValue = this.EditValue; return(vi.CalcHeight(width) + 6); }
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 RichTextEditViewInfo GetViewInfo(ControlGraphicsInfoArgs info) { RepositoryItemMyButtonEdit ri = (info.ViewInfo as ButtonEditViewInfo).Item as RepositoryItemMyButtonEdit; RichTextEditViewInfo vi = new RichTextEditViewInfo(ri.RichEdit); vi.Bounds = info.ViewInfo.ContentRect; vi.EditValue = info.ViewInfo.DisplayText; vi.CalcViewInfo(info.Graphics); return(vi); }
/// <summary>Draws the text.</summary> /// <param name="e">The e.</param> public virtual void DrawText(RichToolTipItemInfoArgs e) { var rtfBounds = e.ViewInfo.TextBounds; var vi = new RichTextEditViewInfo(richTextRepoItem); UpdateRichTextEditViewInfo(e.Cache.Graphics, e.ViewInfo.Text, vi, rtfBounds); RichTextEditPainter.DrawRTF(vi, e.Cache); }
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); }