Esempio n. 1
0
        public void AddSingleImage(GlobalElementsValues oElement)
        {
            numImage = flowLayoutPanel1.Controls.Count;

            if (numImage < 0)
            {
                numImage = 0;
            }

            numImage++;

            oPict          = new PictureBox();
            oPict.Size     = PictSize;
            oPict.Image    = Properties.Resources.frame2;
            oPict.SizeMode = PictureBoxSizeMode.StretchImage;

            oPict.BackgroundImage = oElement.OImage;

            oPict.BackgroundImageLayout = ImageLayout.Stretch;
            oPict.Region = Shape.RoundedRegion(oPict.Size, 3, Shape.Corner.None);

            oPict.Name = numImage.ToString();

            oPict.MouseEnter += new EventHandler(oPict_MouseEnter);
            oPict.MouseLeave += new EventHandler(oPict_MouseLeave);

            flowLayoutPanel1.Controls.Add(oPict);

            GlobalElementsDetails.Add(oElement);

            oPict.Tag = GlobalElementsDetails[numImage - 1];
        }
Esempio n. 2
0
        void oPict_MouseEnter(object sender, EventArgs e)
        {
            PictureBox pb = (PictureBox)sender;

            try
            {
                tempElementsValues = (GlobalElementsValues)pb.Tag;
                panel11.Parent     = pb;

                auxPBox = pb;//We create temp object so we can dispose it

                panel11.Location = new Point((pb.Width - panel11.Width) - 10, (pb.Height - panel11.Height) - 10);
                panel11.BringToFront();
                panel11.Visible = true;
            }
            catch { }
            finally { }
        }
Esempio n. 3
0
        void oPict_MouseEnter(object sender, EventArgs e)
        {
            if (btnOcultarVistaPrevia.Visible == true)
            {
                PictureBox pb = (PictureBox)sender;

                //try
                //{
                tempElementsValues = (GlobalElementsValues)pb.Tag;

                VisualizarImagen(pb.BackgroundImage);
                globalIndex   = tempElementsValues.OIndex;
                oImagenActual = pb.BackgroundImage;

                MostrarFocoImagen(pb.Parent);

                auxPBox     = pb;
                direccImage = pb.Tag.ToString().Trim();
                //}
                //catch { }
                //finally { }
            }
        }
Esempio n. 4
0
        public void AddImages(FlowLayoutPanel pFlowPanel, string[] pFileNames, PictureBox pPict, int pStep, ProgressBar pBar)
        {
            try
            {
                if (globalElementsDetails == null)
                {
                    globalElementsDetails = new List <GlobalElementsValues>();
                }

                if (pFileNames.Length <= 250)
                {
                    pBar.Step = pStep;

                    foreach (string oFileName in pFileNames)
                    {
                        Application.DoEvents();

                        numImage = pFlowPanel.Controls.Count;

                        if (numImage < 0)
                        {
                            numImage = 0;
                        }

                        numImage++;

                        pPict          = new PictureBox();
                        pPict.Size     = PictSize;
                        pPict.Image    = Properties.Resources.frame2;
                        pPict.SizeMode = PictureBoxSizeMode.StretchImage;

                        pPict.BackgroundImage = SafeImage.NonLockingOpen(oFileName.Trim());

                        pPict.BackgroundImageLayout = ImageLayout.Stretch;
                        pPict.Region = Shape.RoundedRegion(pPict.Size, 3, Shape.Corner.None);

                        if (nuevo == true)
                        {
                            pPict.Tag = oFileName.Trim();
                        }
                        else
                        {
                            pPict.Tag = numImage.ToString();
                        }

                        pPict.Name = numImage.ToString();

                        pPict.MouseEnter += new EventHandler(oPict_MouseEnter);
                        pPict.MouseLeave += new EventHandler(oPict_MouseLeave);

                        oGlobalElementsValues           = new GlobalElementsValues();
                        oGlobalElementsValues.OIndex    = numImage - 1;
                        oGlobalElementsValues.OFileName = pPict.Tag.ToString();
                        oGlobalElementsValues.OImage    = pPict.BackgroundImage;
                        oGlobalElementsValues.OBytes    = File.ReadAllBytes(oFileName.Trim());

                        globalElementsDetails.Add(oGlobalElementsValues);

                        pPict.Tag = globalElementsDetails[numImage - 1];

                        pFlowPanel.Controls.Add(pPict);

                        pBar.PerformStep();
                    }
                }
                else
                {
                    MessageBox.Show(this, "Por motivos de desempeño, no se permite agregar más de 250 imágenes a la vez", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
            catch { }
        }