コード例 #1
0
        public GifDrawingWindow(AnimatedImage.AnimatedGif animatedGif, int width, int height)
        {
            InitializeComponent();
            var screenHeight = SystemParameters.VirtualScreenHeight;
            var screenWidth  = SystemParameters.VirtualScreenWidth;

            _animatedGif    = animatedGif;
            GifImage.Source = _animatedGif.Source;
            _imageWidth     = width;
            _imageHeight    = height;

            var winHeight = _imageHeight + 140.0;
            var winWidth  = _imageWidth + 40.0;

            if (winHeight < 400)
            {
                winHeight = 400;
            }
            else if (winHeight > screenHeight)
            {
                winHeight = screenHeight;
            }
            if (winWidth < 400)
            {
                winWidth = 400;
            }
            else if (winWidth > screenWidth)
            {
                winWidth = screenWidth;
            }
            Height = winHeight;
            Width  = winWidth;
            ImageVisulGrid.Height = _imageHeight;
            ImageVisulGrid.Width  = _imageWidth;

            _linePoints     = new List <Point>();
            _isSave         = false;
            _drawingChanged = false;
            _selectedButton = PenToolBtn;
            _drawingTool    = DrawingTool.PenTool;
            _pickedColor    = Color.Transparent;
            _drawingManager = new DrawingManager(TargetImage, new Bitmap(_imageWidth, _imageHeight, PixelFormat.Format32bppArgb))
            {
                RedoButtuon = RedoButton,
                UndoButton  = UndoButton,
            };

            _drawingConfigution = new DrawingConfig();
            _drawingConfigution.LoadConfigFromXml(ConfigurationManager.AppSettings[ConfigPathKey]);
        }
コード例 #2
0
        public DrawingWindow(Bitmap bitmap)
        {
            InitializeComponent();
            var screenHeight = SystemParameters.VirtualScreenHeight;
            var screenWidth  = SystemParameters.VirtualScreenWidth;

            var height = bitmap.Height + 140.0;
            var width  = bitmap.Width + 40.0;

            if (height < 400)
            {
                height = 400;
            }
            else if (height > screenHeight)
            {
                height = screenHeight;
            }
            if (width < 400)
            {
                width = 400;
            }
            else if (width > screenWidth)
            {
                width = screenWidth;
            }
            Height = height;
            Width  = width;

            _linePoints     = new List <Point>();
            _isSave         = false;
            _drawingChanged = false;
            _selectedButton = PenToolBtn;
            _drawingTool    = DrawingTool.PenTool;
            _pickedColor    = Color.Transparent;
            _drawingManager = new DrawingManager(TargetImage, bitmap)
            {
                RedoButtuon = RedoButton,
                UndoButton  = UndoButton,
            };

            _drawingConfigution = new DrawingConfig();
            _drawingConfigution.LoadConfigFromXml(ConfigurationManager.AppSettings[ConfigPathKey]);
        }