Пример #1
0
 private void TrackBarThickness_Scroll(object sender, EventArgs e)
 {
     settings.SetPenWidth(TrackBarThickness.Value);
     PictureBoxThickness.Image = drawingEngine.GetPenImage();
     if (_isFigureSelected)
     {
         drawingEngine.ChangePenWidth(TrackBarThickness.Value);
         drawingEngine.SelectFigure();
         PictureBoxPaint.Image = drawingEngine.MainImage;
     }
 }
Пример #2
0
        private void MainPaint_Load(object sender, EventArgs e)
        {
            settings     = Settings.Initialize();
            mouseHandler = MouseHandler.Initialize();
            penPreview   = PenPreview.Initialize(settings.Pen, PictureBoxThickness.Width, PictureBoxThickness.Height);
            storage      = Storage.Initialize();

            drawingEngine = new DrawingEngine(settings, mouseHandler, penPreview, storage);

            PictureBoxThickness.Image = drawingEngine.GetPenImage();
            PictureBoxPaint.Image     = drawingEngine.MainImage;

            currentProcess = Process.GetCurrentProcess();
            currentProcess.Refresh();
            memoryLabel.Text = "Memory usage: " + ((float)currentProcess.PrivateMemorySize64 / 1024f / 1024f).ToString("F1") + "MB";

            _isLineFinished   = true;
            _isBtnFillClicked = false;
            _isFigureCreated  = false;
            _isFirstPointAdd  = false;
            _isFigureSelected = false;


            this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            this.UpdateStyles();

            NumericUpDownPolygon.Value = settings.numberOfPolygonApexes;
        }