コード例 #1
0
 void reportDocument_ImageProcessing(object sender, ImageEventArgs e)
 {         
     if (_clinic.Logo != null)
     e.Image.Source = ImageDataConverter.BytesToBitmapImage(_clinic.Logo);
 }
コード例 #2
0
        /// <summary>
        /// Event occurs for each image before it is processed
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">image event details</param>
        private void reportDocument_ImageProcessing(object sender, ImageEventArgs e)
        {
            System.Drawing.Bitmap bitmap = null;

            if (e.Image.Name == "imageDynamic1")
            {
                // create image dynamically
                bitmap = new System.Drawing.Bitmap(100, 100);
                for (int y = 0; y < bitmap.Height; y++)
                {
                    for (int x = 0; x < bitmap.Width; x++)
                    {
                        bitmap.SetPixel(x, y, System.Drawing.Color.FromArgb((byte)(x + y), (byte)(x + y), 0));
                    }
                }
            }

            if (e.Image.Name == "imageDynamic2")
            {
                // create image dynamically
                bitmap = new System.Drawing.Bitmap(100, 100);
                for (int y = 0; y < bitmap.Height; y++)
                {
                    for (int x = 0; x < bitmap.Width; x++)
                    {
                        bitmap.SetPixel(x, y, System.Drawing.Color.FromArgb((byte)(x), (byte)(y), 0));
                    }
                }
            }

            if (bitmap != null)
            {
                // save this image into a memory stream
                MemoryStream mem = new MemoryStream();
                bitmap.Save(mem, System.Drawing.Imaging.ImageFormat.Bmp);
                mem.Position = 0;

                // load new media image into report
                BitmapImage image = new BitmapImage();
                image.BeginInit();
                image.StreamSource = mem;
                image.EndInit();
                e.Image.Source = image;
            }
        }
コード例 #3
0
 private void reportDocument_ImageProcessing(object sender, ImageEventArgs e)
 {
     if (e.Image.Name == "ClinicLogo")
     {
         if (_clinic.Logo != null) e.Image.Source = ImageDataConverter.BytesToBitmapImage(_clinic.Logo);
     }
     else
     {               
         if (_count < _nPhoto)
         {
             e.Image.Source = ImageDataConverter.BytesToBitmapImage(_esRecord.EndoscopyPhotoes.ElementAt(_count).Photo);
         }
         else
         {
             e.Image.Visibility = Visibility.Collapsed;
         }
         _count++;
     }
 }