Пример #1
0
        public PreviewHandlerForm(PreviewContext context, IPreviewGenerator previewGenerator)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (previewGenerator == null)
            {
                throw new ArgumentNullException("previewGenerator");
            }

            _context                 = context;
            _previewGenerator        = previewGenerator;
            context.PreviewRequired += _PreviewRequired;
            context.ViewPortChanged += _ViewPortChanged;

            InitializeComponent();
        }
        public PreviewHandlerController()
        {
            try
            {
                Logging.InstallListeners();

                _context = new PreviewContext();

                var previewGeneratorFactory = new PreviewGeneratorFactory(_context.Settings);
                var generator = previewGeneratorFactory.Create();

                _previewForm = new PreviewHandlerForm(_context, generator);
                _previewForm.Handle.GetHashCode(); //initialse the form
            }
            catch (Exception exc)
            {
                Trace.TraceError("PreviewHandlerController.ctor: {0}", exc);
            }
        }
Пример #3
0
        public PreviewControl(Image preview, PreviewContext context)
        {
            if (preview == null)
            {
                throw new ArgumentNullException("preview");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _originalPreview = preview;
            _context         = context;
            InitializeComponent();
            picPreview.Image = _ResizePreviewImageToSize(preview, context.DrawingSize);
            picPreview.Size  = preview.Size;

            itmZoomIn.Enabled  = context.DrawingSize != null;
            itmZoomOut.Enabled = context.DrawingSize != null;
            _UpdateDrawingDetails();
        }