I've inherited an old .NET 1.1 project which I am migrating to .NET 3.5. This included an old version of PdfSharp which I've replaced with the latest. However, there is some PdfSharp code used in our project which is now deprecated. I include an example below:
Code:
private void DrawBody(XGraphics gr)
{
if (resources != null)
{
using (Pen pen = new Pen(new SolidBrush(titleBackground),2))
{
RectangleF oldClip = gr.Graphics.ClipBounds;
try
{
HPResource resource;
RectangleF clipRect = CalcClipRect(gr);
int i = 0;
int row = startRow;
lastPrintPos = headerHeight+1;
while ((row < resources.Count) && (lastPrintPos+resources[row].RowHeight <= Math.Round(clipRect.Bottom+(toPrinter ? 0 : resources.PlanHeight), 0)))
{
resource = resources[row];
ticBottom = lastPrintPos+resource.RowHeight;
// get the content drawn
DrawBodyContent(gr, resource);
i++;
gr.DrawLine(pen, left, ticBottom, left+width-1, ticBottom);
lastPrintPos = ticBottom;
row++;
lastPrintRow = row ;
}
printFinished = (row == resources.Count && canFinish);
}
finally
{
gr.SetClip(oldClip, XCombineMode.Replace);
}
}
}
}
The call to SetClip in the finally clause is throwing an error since this method is deprecated in the latest PdfSharp. The error suggests using IntersectClip instead but this seems to do something different. How can I achieve the same result in the new PdfSharp as the deprecated SetClip call?
Any help greatly appreciated.