Beispiel #1
0
 public FormMain()
 {
     InitializeComponent();
     engine                 = new FormStitchEngine();
     stitchModule           = new QuickStitch();
     buttonAddLeft.Visible  = false;
     buttonAddRight.Visible = false;
     ResizePictureBoxes();
 }
        public void AddImage(Panel panel, QuickStitch stitchModule, Side side)
        {
            string fileName = OpenImageFile();

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            Bitmap     image     = new Bitmap(fileName);
            ImageData  imageData = new ImageData(fileName, image);
            ZoomPicBox picBox    = CreatePictureBox(image);

            panel.Controls.Add(picBox);

            switch (side)
            {
            case Side.Left:
                // Insert at beginning
                stitchModule.ImageDataCollection.Insert(0, imageData);
                ImageBoxes.Insert(0, picBox);
                ResizePicBoxes(panel);
                break;

            case Side.Right:
                // Insert at the end
                stitchModule.ImageDataCollection.Add(imageData);
                ImageBoxes.Add(picBox);
                ResizePicBoxes(panel);
                break;

            case Side.Main:
                stitchModule.MainImageData = imageData;
                stitchModule.ImageDataCollection.Add(imageData);
                picBox.Size  = panel.ClientSize;
                MainImageBox = picBox;
                ImageBoxes.Add(picBox);
                break;

            default:
                break;
            }

            panel.Refresh();
        }