コード例 #1
0
        private void reset()
        {
            CurrentBitmapSource = new WriteableBitmap((BitmapSource)Application.Current.FindResource("OriginalBitmap"));

            fillImage.Source = CurrentBitmapSource;

            if (filler != null)
            {
                filler.Dispose();
                filler = null;
            }
            if (timer != null)
            {
                timer.Stop();
            }

            textBlock.Text           = "请点击图片中的白色位置开始填充。";
            btnPauseResume.Content   = "";
            btnPauseResume.IsEnabled = false;
        }
コード例 #2
0
        private void fillImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (filler == null)
            {
                filler = new FloodFiller(CurrentBitmapSource, newColor, System.Drawing.Color.White);

                Binding bd = new Binding();
                bd.Source = filler;
                bd.Path   = new PropertyPath("TotalTimesString");
                textBlock.SetBinding(TextBlock.TextProperty, bd);
            }
            if (!filler.HasStarted)
            {
                System.Windows.Point p = e.GetPosition(fillImage);

                filler.setStartPoint(p.X, p.Y, fillImage.ActualWidth, fillImage.ActualHeight);

                startTimer();

                btnPauseResume.IsEnabled = true;
            }
        }