Exemplo n.º 1
0
        private void FormMain_ResizeEnd(object sender, EventArgs e)
        {
            try
            {
                ConfigBusiness.SetHeight(Height.ToString());
                ConfigBusiness.SetWidth(Width.ToString());

                int imagesHeightTotal = pictureBoxBoxart.Size.Height * 3;
                int heightLeft        = flowLayoutPanelPictures.Size.Height - imagesHeightTotal;

                if (heightLeft < 25 && heightLeft > 0)
                {
                    return;
                }

                if (heightLeft > 0)
                {
                    int heightForEachPicture = Convert.ToInt32(heightLeft / 3) + pictureBoxBoxart.Size.Height - 6;

                    flowLayoutPanelPictures.Size = new Size(heightForEachPicture + 6, dataGridView.Size.Height);
                    pictureBoxBoxart.Size        = new Size(heightForEachPicture, heightForEachPicture);
                    pictureBoxTitle.Size         = new Size(heightForEachPicture, heightForEachPicture);
                    pictureBoxGameplay.Size      = new Size(heightForEachPicture, heightForEachPicture);
                }
                else
                {
                    int heightForEachPicture = pictureBoxBoxart.Size.Height - 6 - Convert.ToInt32(heightLeft * -1 / 3);

                    flowLayoutPanelPictures.Size = new Size(heightForEachPicture + 6, dataGridView.Size.Height);
                    pictureBoxBoxart.Size        = new Size(heightForEachPicture, heightForEachPicture);
                    pictureBoxTitle.Size         = new Size(heightForEachPicture, heightForEachPicture);
                    pictureBoxGameplay.Size      = new Size(heightForEachPicture, heightForEachPicture);
                }
            }
            catch (Exception ex)
            {
                FormCustomMessage.ShowError(ex.Message);
            }
        }