How can I change my application Images?
Posted: Fri Feb 03, 2012 4:08 am
Hi,
(VS2010 c# .NET 4 for Winfrom)
I know how to change the text from my application, Frist I create new variable of string from Dictionary, then I can change it with my application.
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
rep["Name"] = "Nathan";
rep["Age"] = "23";
...
So it is OK.
But I want to change images from my application or from file, I made a image component from Stimulsoft Designer Tools, Then made image variable named MyImage. So ImageData is {MyImage}, Edit Variable: Name:MyImage, Alias:MyImage,Type:image,value.
Then my code is,
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
rep["Name"] = "Nathan";
rep["Age"] = "23";
StiImage image = new StiImage();
image.Image = Image.FromFile("pic01.jpg"); //the path of the image is correct;
rep["MyImage"] = image; //Wrong here;
stiViewerControl1.Report = rep;
rep.Render();
Or
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
StiImage image = new StiImage();
image.Image = Image.FromFile("pic01.jpg"); //the path of the image is correct;
rep.Compile();
rep["MyImage"] = image; //Wrong here;
rep.Show();
I compile both my code, there are wrong, rep["MyImage"] = image; "Stimulsoft.Report.Components.StiImage" object can not change to "System.Drawing.Image".
So, please help me, thanks.
(VS2010 c# .NET 4 for Winfrom)
I know how to change the text from my application, Frist I create new variable of string from Dictionary, then I can change it with my application.
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
rep["Name"] = "Nathan";
rep["Age"] = "23";
...
So it is OK.
But I want to change images from my application or from file, I made a image component from Stimulsoft Designer Tools, Then made image variable named MyImage. So ImageData is {MyImage}, Edit Variable: Name:MyImage, Alias:MyImage,Type:image,value.
Then my code is,
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
rep.Compile();
rep["Name"] = "Nathan";
rep["Age"] = "23";
StiImage image = new StiImage();
image.Image = Image.FromFile("pic01.jpg"); //the path of the image is correct;
rep["MyImage"] = image; //Wrong here;
stiViewerControl1.Report = rep;
rep.Render();
Or
Stimulsoft.Report.StiReport rep = new Stimulsoft.Report.StiReport();
rep.Load("report.mrt");
StiImage image = new StiImage();
image.Image = Image.FromFile("pic01.jpg"); //the path of the image is correct;
rep.Compile();
rep["MyImage"] = image; //Wrong here;
rep.Show();
I compile both my code, there are wrong, rep["MyImage"] = image; "Stimulsoft.Report.Components.StiImage" object can not change to "System.Drawing.Image".
So, please help me, thanks.