Example #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());
                }
            }
        }
Example #2
0
 public void FillRectangle(NSD.Rect bounds)
 {
     _graphics.FillRectangle(_foreBrush,
                             (float)bounds.X,
                             (float)bounds.Y,
                             (float)bounds.Width,
                             (float)bounds.Height);
 }
Example #3
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()));
         }
     }
 }
Example #4
0
 public void DrawRectangle(NSD.Rect bounds, int strokeThickness, Color stroke)
 {
     // looks like this method is unusable
     throw new InvalidOperationException("Should never be here");
 }