예제 #1
0
        override internal void Run(IPresent ip, Row row)
        {
            base.Run(ip, row);

            string mtype = null;
            Stream strm  = null;

            try
            {
                strm = GetImageStream(ip.Report(), row, out mtype);

                ip.Image(this, row, mtype, strm);
            }
            catch
            {
                // image failed to load;  continue processing
            }
            finally
            {
                if (strm != null)
                {
                    strm.Close();
                }
            }
            return;
        }
예제 #2
0
        override internal void Run(IPresent ip, Row row)
        {
            Report rpt = ip.Report();

            ICustomReportItem cri = null;

            try
            {
                cri = RdlEngineConfig.CreateCustomReportItem(_Type);
                Type   a  = cri.GetType();
                Bitmap bm = null;
                SetProperties(rpt, row, cri);
                int width = WidthCalc(rpt, null) -
                            (Style == null ? 0 :
                             (Style.EvalPaddingLeftPx(rpt, row) + Style.EvalPaddingRightPx(rpt, row)));
                int height = RSize.PixelsFromPoints(this.HeightOrOwnerHeight) -
                             (Style == null ? 0 :
                              (Style.EvalPaddingTopPx(rpt, row) + Style.EvalPaddingBottomPx(rpt, row)));
                bm = new Bitmap(width, height);
                cri.DrawImage(ref bm);

                MemoryStream ostrm = new MemoryStream();
                // 06122007AJM Changed to use high quality JPEG encoding
                //bm.Save(ostrm, IMAGEFORMAT);	// generate a jpeg   TODO: get png to work with pdf
                System.Drawing.Imaging.ImageCodecInfo[] info;
                info = ImageCodecInfo.GetImageEncoders();
                EncoderParameters encoderParameters;
                encoderParameters = new EncoderParameters(1);
                // 20022008 AJM GJL - Using centralised image quality
                encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, ImageQualityManager.CustomImageQuality);
                System.Drawing.Imaging.ImageCodecInfo codec = null;
                for (int i = 0; i < info.Length; i++)
                {
                    if (info[i].FormatDescription == "JPEG")
                    {
                        codec = info[i];
                        break;
                    }
                }
                bm.Save(ostrm, codec, encoderParameters);

                ip.Image(new Image(rpt.ReportDefinition, this, xNode), row, null, ostrm);
                ostrm.Close();
            }
            catch (Exception ex)
            {
                rpt.rl.LogError(8, string.Format("Exception in CustomReportItem handling.\n{0}\n{1}", ex.Message, ex.StackTrace));
            }
            finally
            {
                if (cri != null)
                {
                    cri.Dispose();
                }
            }
            return;
        }
예제 #3
0
		override internal void Run(IPresent ip, Row row)
		{
			base.Run(ip, row);

			string mtype=null; 
			Stream strm=null;
			try 
			{
				strm = GetImageStream(ip.Report(), row, out mtype);

				ip.Image(this, row, mtype, strm);
			}
			catch
			{
				// image failed to load;  continue processing
			}
			finally
			{
				if (strm != null)
					strm.Close();
			}
			return;
		}