Home Forums WinForms controls Xceed Grid for WinForms Problem Printing Custom Elements: Reply To: Problem Printing Custom Elements:

User (Old forums)
Member
Post count: 23064

Thanks for the reply, when I used your example, it worked for me too, however I played around a little more and it seems that the custom class isn’t used when printing, example:
<code>
public class CustomTextRow : TextRow
{
public CustomTextRow() : base() { }
public CustomTextRow(string text) : base(text) { }
protected CustomTextRow(CustomTextRow template) : base(template) { }

protected override Row CreateInstance()
{
return new CustomTextRow(this);
}

protected override void PaintForeground(GridPaintEventArgs e)
{
using (SolidBrush brush = new SolidBrush(this.ForeColor))
{
e.Graphics.DrawString(“Print Me: ” + this.Text, this.Font, brush, e.ClientRectangle);
}
}
}
</code>

You’ll notice that on the grid you’ll see the “Print Me: ” prefix, but not on the Report.

Note: This isn’t the class I’m using in my application, it’s just a demonstration of the problem, my actual class positions text (which isn’t from the “Text” property) in multuiple spots along the row.

Are the overridden paint methods of the class not used when printing? The “Printing” property of the arguments would suggest they are, but it doesn’t look like it to me, unless I’m missing something.

Regards,

– Aaron.

Imported from legacy forums. Posted by AaronY (had 340 views)