Ejemplo n.º 1
0
        private void RefreshPreviewImage()
        {
            if (_previewImage != null)
            {
                _previewImage.Dispose();
            }
            NSD.Point dpi;
            using (Graphics g = this.CreateGraphics())
                dpi = new NSD.Point(g.DpiX, g.DpiY);
            using (Doc.Util.C1DXGraphics graphics = new Doc.Util.C1DXGraphics())
            {
                //
                NSD.Size sz = previewPanel.ClientSize;
                graphics.BeginGetImage(sz, dpi);
                graphics.FillRectangle(Color.White, new NSD.Rect(0, 0, sz.Width, sz.Height));
                NSD.Rect previewBounds = new NSD.Rect(c_PreviewOffset, c_PreviewOffset, sz.Width - c_PreviewOffset * 2, sz.Height - c_PreviewOffset * 2);
                _previewObject.Style.Borders = _border;
                _previewFragment.Draw(graphics, previewBounds, null, null);

                using (Doc.C1Image image = graphics.EndGetImage(false))
                {
                    _previewImage = Image.FromStream(image.GetData());
                }
            }
        }
Ejemplo n.º 2
0
 public static Image GetBrushImage(Color backcolor, C1Brush brush, C1.Win.Interop.Size size, C1.Win.Interop.Point dpi)
 {
     using (var dxGraphics = new C1DXGraphics())
     {
         dxGraphics.BeginGetImage(size, dpi);
         var bounds = new C1.Win.Interop.Rect(0, 0, size.Width, size.Height);
         dxGraphics.FillRectangle(backcolor, bounds);
         dxGraphics.FillRectangle(brush, bounds);
         using (C1Image image = dxGraphics.EndGetImage(false))
         {
             return(Image.FromStream(image.GetData()));
         }
     }
 }