CreateVisual
(
Point currentMouseLocation,
Color backgroundContrastColor
)
{
Debug.Assert(m_bDragIsInProgress);
AssertValid();
// Limit the drag to the graph margins.
currentMouseLocation =
ForcePointToBeWithinMargins(currentMouseLocation);
m_oMarqueeRectangle = CreateMarqueeRectangle(currentMouseLocation);
DrawingVisual oDrawingVisual = new DrawingVisual();
SolidColorBrush oFillBrush = new SolidColorBrush(Color.FromArgb(
MarqueeFillAlpha,
backgroundContrastColor.R,
backgroundContrastColor.G,
backgroundContrastColor.B
) );
SolidColorBrush oOutlineBrush = new SolidColorBrush(Color.FromArgb(
MarqueeOutlineAlpha,
backgroundContrastColor.R,
backgroundContrastColor.G,
backgroundContrastColor.B
) );
Pen oOutlinePen = new Pen(oOutlineBrush, 1);
WpfGraphicsUtil.FreezeIfFreezable(oFillBrush);
WpfGraphicsUtil.FreezeIfFreezable(oOutlineBrush);
WpfGraphicsUtil.FreezeIfFreezable(oOutlinePen);
using ( DrawingContext oDrawingContext = oDrawingVisual.RenderOpen() )
{
oDrawingContext.DrawRectangle(oFillBrush, oOutlinePen,
m_oMarqueeRectangle);
}
m_oVisual = oDrawingVisual;
return (m_oVisual);
}