Wednesday, March 21, 2012

Image from Business Object property?

Hello!
I'm using the local reporting services engine within a WinForm
application. I have a Business Object that contains a field which returns a
Bitmap. The Bitmap is created from other values within the same business
object. An example of the properties are below.
I'm binding my report to my BusinessObject and everything is going quite
well with the exception of displaying the graph bitmap within an Image
ReportItem. I've tried different Source types for the Image properties -
Database, Embedded, External but none seem to like the Bitmap within a
property on the Object Data Source.
I saw a few ways to develop a CustomerReportItem and will head down that
road but it seems like I'm missing something really simple. Any thoughts or
helpful tips are welcome.
Thanx,
Mike Q
public class MyBusinessObject
{
public decimal IndexValue
{
get
{
some calculations;
}
}
public Bitmap IndexGraph
{
get
{
Bitmap Result = Bitmap.FromFile("GraphTemplate.bmp");
Graphics g = Graphics.FromImage(Result);
Pen RedPen = new Pen(Brushes.Red, 5);
g.DrawLine(RedPen, 40, 0, 40, 50); // These values are calculated based on
the Index value.
return Result;
}
}
}I found the answer - instead of returning a Bitmap - return a byte[] from
the business object property
Thanx,
-q
"Mike Q" <MQuinn_q@.Yahoo.com> wrote in message
news:OMHy2SVrIHA.4280@.TK2MSFTNGP02.phx.gbl...
> Hello!
> I'm using the local reporting services engine within a WinForm
> application. I have a Business Object that contains a field which returns
> a Bitmap. The Bitmap is created from other values within the same
> business object. An example of the properties are below.
> I'm binding my report to my BusinessObject and everything is going quite
> well with the exception of displaying the graph bitmap within an Image
> ReportItem. I've tried different Source types for the Image properties -
> Database, Embedded, External but none seem to like the Bitmap within a
> property on the Object Data Source.
> I saw a few ways to develop a CustomerReportItem and will head down that
> road but it seems like I'm missing something really simple. Any thoughts
> or helpful tips are welcome.
> Thanx,
> Mike Q
>
> public class MyBusinessObject
> {
> public decimal IndexValue
> {
> get
> {
> some calculations;
> }
> }
> public Bitmap IndexGraph
> {
> get
> {
> Bitmap Result = Bitmap.FromFile("GraphTemplate.bmp");
> Graphics g = Graphics.FromImage(Result);
> Pen RedPen = new Pen(Brushes.Red, 5);
> g.DrawLine(RedPen, 40, 0, 40, 50); // These values are calculated based
> on the Index value.
> return Result;
> }
> }
> }

No comments:

Post a Comment