double sizfact = (double)(ImgGauge.Value + 25) / 100; // Fra 25 til 225 % CardInfo CrdInf; String fname; int imHeight = Convert.ToInt16(242 * sizfact); int imWidth = Convert.ToInt16(164 * sizfact); byte Rank; PictureBox img = new PictureBox(); img.Anchor = AnchorStyles.Top | AnchorStyles.Left; img.SizeMode = PictureBoxSizeMode.Zoom; img.Margin = new Padding(0); img.Width = imWidth; img.Height = imHeight; img.Top = (int)(3 + row * (imHeight + 3)); img.Left = (int)(3 + pos++ * (imWidth + 3)); img.Tag = card; img.Name = "card_" + card + "_" + row.ToString() + "-" + pos.ToString() + "_" + img.Top.ToString() + "-" + img.Left.ToString(); if ((3 + (pos + 1) * (imWidth + 3)) >= cardpanel.Width) { // adjust panel height pos = 0; row++; cardpanel.Height = (int)(3 + (row + 1) * (imHeight + 3)); } labelPanelHeight.Text = cardpanel.Height.ToString(); labelRows.Text = row.ToString(); labelLatestTop.Text = img.Top.ToString(); labelLastCard.Text = img.Name; fname = ((CardInfo)cardstable[card]).Ikon; if ((fname == null) || (fname.Length < 1)) fname = FindCardIkon(card); img.ImageLocation = fname; img.MouseEnter += new EventHandler(CollectionPictureMouseEnter); img.MouseLeave += new EventHandler(CollectionPictureMouseLeave); img.Click += new EventHandler(RankSet_Click); cardpanel.Controls.Add(img);
pos = 0; row++; cardpanel.Height = (int)(3 + (row + 1) * (imHeight + 3));