CreateLegendImages
(
IEnumerable<LegendControlBase> oLegendControls,
Double dImageWidth,
out IEnumerable<Image> oImages,
out Double dTotalImageHeight
)
{
Debug.Assert(oLegendControls != null);
Debug.Assert(dImageWidth > 0);
AssertValid();
List<Image> oLegendImages = new List<Image>();
oImages = oLegendImages;
dTotalImageHeight = 0;
foreach (LegendControlBase oLegendControl in oLegendControls)
{
if (oLegendControl.Visible && oLegendControl.Height > 0)
{
System.Windows.Media.Imaging.BitmapSource oBitmapSource;
using ( System.Drawing.Bitmap oBitmap =
oLegendControl.DrawOnBitmap(
(Int32)Math.Ceiling(dImageWidth) ) )
{
oBitmapSource = WpfGraphicsUtil.BitmapToBitmapSource(
oBitmap);
}
Image oLegendImage = new Image();
oLegendImage.Source = oBitmapSource;
oLegendImage.Width = dImageWidth;
oLegendImage.Measure(new Size(
dImageWidth, Double.PositiveInfinity) );
oLegendImages.Add(oLegendImage);
dTotalImageHeight += oLegendImage.DesiredSize.Height;
}
}
}