Esempio n. 1
0
        public OperationPictureBox(ImageForm parentForm, ImageDisplayDef imageDisplayDef)
        {
            mParentForm      = parentForm;
            mOperationForm   = parentForm.OpForm();
            mImageDisplayDef = imageDisplayDef;
            mImageDisplayDef.ImageDisplayDefChange += new ImageDisplayDef.ImageDisplayDefChangeDelegate(HandleDisplayDefChange);

            this.MouseDown      += new System.Windows.Forms.MouseEventHandler(image_MouseDown);
            this.MouseUp        += new System.Windows.Forms.MouseEventHandler(image_MouseUp);
            this.MouseMove      += new System.Windows.Forms.MouseEventHandler(image_MouseMove);
            this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.image_PreviewKeyDown);
            this.KeyDown        += new System.Windows.Forms.KeyEventHandler(this.image_KeyDown);
            this.Paint          += new System.Windows.Forms.PaintEventHandler(this.pictureBox_Paint);
            this.DoubleClick    += new EventHandler(OperationPictureBox_DoubleClick);

            this.ContextMenu = new ContextMenu();
            this.ContextMenu.MenuItems.Add("Retest Image", new EventHandler(menu_retestImageSelected));
            this.ContextMenu.MenuItems.Add("Save Image", new EventHandler(menu_saveImageSelected));
            mImageDisplayDef.AddDisplayMenu(this.ContextMenu);

            /*
             * popUpMenu = new ContextMenu();
             * this.ContextMenu = popUpMenu;
             * mImageDisplayDef.AddDisplayMenu(popUpMenu);
             */
//            Dock = DockStyle.None;
//            debugText = "" + mIndex+ "|" + x + "," + y;
        }
Esempio n. 2
0
        public void Clone(ImageDisplayDef theSourceDef)
        {
            if (theSourceDef.TestSequence != mTestSequence)
            {
                throw new ArgumentException("3292289");
            }

            mImageDefinition = theSourceDef.ImageDefinition;

            roisToShow.Clear();
            roisToShow.AddRange(theSourceDef.roisToShow);

            decorationsToShow.Clear();
            decorationsToShow.AddRange(theSourceDef.decorationsToShow);

            mSizeMode = theSourceDef.SizeMode;

            if (ImageDisplayDefChange != null)
            {
                ImageDisplayDefChange();
            }
        }
Esempio n. 3
0
        private void ResizeImageTable(int newNumCol, int newNumRows)
        {
            OperationPictureBox[,] newPicBoxArray = new OperationPictureBox[newNumCol, newNumRows];

            ImageDisplayDef imageDisplayDef;

            int newColumnsAdded = newNumCol - pictureBoxes.GetUpperBound(0) - 1;

            if (newColumnsAdded >= 0)
            {
                // copy old picture boxes to the new array
                for (int y = 0; y <= Math.Min(pictureBoxes.GetUpperBound(1), newPicBoxArray.GetUpperBound(1)); y++)
                {
                    for (int x = 0; x <= pictureBoxes.GetUpperBound(0); x++)
                    {
                        newPicBoxArray[x, y] = pictureBoxes[x, y];
                        pictureBoxes[x, y]   = null; // remove it from the old array so that we don't remove it from the Panel during cleanup (below)
                    }
                }
            }
            else if (newColumnsAdded < 0)
            {
                // copy old picture boxes to the new array...slide them over to the left while we are at it
                for (int y = 0; y <= Math.Min(pictureBoxes.GetUpperBound(1), newPicBoxArray.GetUpperBound(1)); y++)
                {
                    for (int x = 0; x <= newPicBoxArray.GetUpperBound(0); x++)
                    {
                        newPicBoxArray[x, y] = pictureBoxes[x, y];
                        pictureBoxes[x, y]   = null; // remove it from the old array so that we don't remove it from the Panel during cleanup (below)
                    }
                }
            }
            // fill in any newly created slots with new picture boxes
            for (int y = 0; y <= newPicBoxArray.GetUpperBound(1); y++)
            {
                if (newPicBoxArray[0, y] != null && newPicBoxArray[0, y].ImageDisplayDef != null)
                {
                    imageDisplayDef = newPicBoxArray[0, y].ImageDisplayDef;
                }
                else
                {
                    imageDisplayDef = new ImageDisplayDef(mParentForm.CurrentSequence);
                }

                for (int x = 0; x <= newPicBoxArray.GetUpperBound(0); x++)
                {
                    if (newPicBoxArray[x, y] == null)
                    {
                        OperationPictureBox newPicBox = new OperationPictureBox(this, imageDisplayDef);
                        newPicBox.mIndex     = x;
                        newPicBoxArray[x, y] = newPicBox;
                        imageLayoutPanel.Controls.Add(newPicBox);
                    }
                    newPicBoxArray[x, y].mIndex = x; // update pictureBoxes' index in case columns were shifted
                }
            }
            // remove obsolete picture boxes from the panel
            for (int y = 0; y <= pictureBoxes.GetUpperBound(1); y++)
            {
                for (int x = 0; x <= pictureBoxes.GetUpperBound(0); x++)
                {
                    if (pictureBoxes[x, y] != null)
                    {
                        imageLayoutPanel.Controls.Remove(pictureBoxes[x, y]);
                    }
                }
            }
            pictureBoxes = newPicBoxArray;
            ResizePictureBoxes();
        }