private void btnAdd_Click(object sender, EventArgs e) { if (openPortraitDialog.ShowDialog() == DialogResult.OK) { foreach (string file in openPortraitDialog.FileNames) { if (lbPortraits.Items.Count >= 17) { break; } Image img = Bitmap.FromFile(file); if (img.Width != 64 || img.Height != 64) { MessageBox.Show("Image must be 64x64!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (img != null) { //Create the new KartImage here byte[] imgData = TextureConversion.RGBA16ToBinary(new Bitmap(img)); Texture texture = new Texture(-1, imgData, Texture.ImageFormat.RGBA, Texture.PixelInfo.Size_16b, 64, 64); F3DEXImage image = new F3DEXImage(texture); MK64Image mkImage = new MK64Image(image, Path.GetFileNameWithoutExtension(file), true); Kart.AddPortrait(mkImage); lbPortraits.Items.Add(mkImage); } } UpdatePortraitCount(); UpdateButtonsEnabled(); } }