DrawBackground
(
IGraph oGraph,
GraphDrawingContext oGraphDrawingContext
)
{
Debug.Assert(oGraph != null);
Debug.Assert(oGraphDrawingContext != null);
AssertValid();
// Draw the background color, followed by the background image if one
// was specified.
DrawingVisual oBackgroundDrawingVisual = new DrawingVisual();
using ( DrawingContext oDrawingContext =
oBackgroundDrawingVisual.RenderOpen() )
{
oDrawingContext.DrawRectangle(
CreateFrozenSolidColorBrush(m_oBackColor), null,
oGraphDrawingContext.GraphRectangle);
if (m_oBackgroundImage != null)
{
oDrawingContext.DrawImage( m_oBackgroundImage,
new Rect( new Size(m_oBackgroundImage.Width,
m_oBackgroundImage.Height) ) );
}
}
m_oVisualCollection.Add(oBackgroundDrawingVisual);
}