コード例 #1
0
 private void btnClearImg_Click(object sender, RoutedEventArgs e)
 {
     myPlot = null;
     canvasPreview.Children.Clear();     //removes previous images/elements from the canvas
     canvasPreview.Background = System.Windows.Media.Brushes.White;
     currentTransition        = GUITransitions.H2imgClear;
     handleGUIstates();
 }
コード例 #2
0
        private void btnSelectImg_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Image file (*.bmp) | *.bmp";
            //bool result = (bool)openFileDialog.ShowDialog();
            if ((bool)openFileDialog.ShowDialog())
            {
                myPlot = new Plottr(openFileDialog.FileName); //creates a plottr object with the selected image

                canvasPreview.Children.Clear();               //removes previous images/elements from the canvas
                myPlot.ImgMoveX = Convert.ToInt32((Plottr.RobotWidth - myPlot.GetImgWidth) / 2);
                myPlot.ImgMoveY = Convert.ToInt32((Plottr.RobotHeight - myPlot.GetImgHeight) / 2);
                placeImageAt(myPlot.ImgMoveX, myPlot.ImgMoveY);     //places the image in the center of preview canvas

                currentTransition = GUITransitions.H0imgOpen;
                handleGUIstates();
            }
        }