private void btnIcon_Click(object sender, EventArgs e) { if (Loading) { return; } ImagePicker.InitialDirectory = I9Gfx.GetPowersetsPath(); ImagePicker.FileName = myPS.ImageName; if (ImagePicker.ShowDialog() != DialogResult.OK) { return; } var str = FileIO.StripPath(ImagePicker.FileName); if (!File.Exists(FileIO.AddSlash(ImagePicker.InitialDirectory) + str)) { MessageBox.Show( $"You must select an image from the {I9Gfx.GetPowersetsPath()} folder!\r\n\r\nIf you are adding a new image, you should copy it the folder and then select it.", "Ah...", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { myPS.ImageName = str; DisplayIcon(); } }
public void DisplayIcon() { if (this.myPS.ImageName != "") { this.picIcon.Image = (Image) new Bitmap((Image) new ExtendedBitmap(I9Gfx.GetPowersetsPath() + this.myPS.ImageName).Bitmap); this.btnIcon.Text = this.myPS.ImageName; } else { this.picIcon.Image = (Image) new Bitmap((Image) new ExtendedBitmap(30, 30).Bitmap); this.btnIcon.Text = "Select Icon"; } }
public void DisplayIcon() { if (myPS.ImageName != "") { picIcon.Image = new Bitmap(new ExtendedBitmap(I9Gfx.GetPowersetsPath() + myPS.ImageName).Bitmap); btnIcon.Text = myPS.ImageName; } else { picIcon.Image = new Bitmap(new ExtendedBitmap(30, 30).Bitmap); btnIcon.Text = "Select Icon"; } }
private void DisplayIcon() { if (!string.IsNullOrEmpty(myPS.ImageName)) { using var extendedBitmap = new ExtendedBitmap(I9Gfx.GetPowersetsPath() + myPS.ImageName); picIcon.Image = new Bitmap(extendedBitmap.Bitmap); btnIcon.Text = myPS.ImageName; } else { using var extendedBitmap = new ExtendedBitmap(30, 30); picIcon.Image = new Bitmap(extendedBitmap.Bitmap); btnIcon.Text = "Select Icon"; } }
void btnIcon_Click(object sender, EventArgs e) { if (!this.Loading) { this.ImagePicker.InitialDirectory = I9Gfx.GetPowersetsPath(); this.ImagePicker.FileName = this.myPS.ImageName; if (this.ImagePicker.ShowDialog() == DialogResult.OK) { string str = FileIO.StripPath(this.ImagePicker.FileName); if (!File.Exists(FileIO.AddSlash(this.ImagePicker.InitialDirectory) + str)) { Interaction.MsgBox("You must select an image from the " + I9Gfx.GetPowersetsPath() + " folder!\r\n\r\nIf you are adding a new image, you should copy it to the folder and then select it.", MsgBoxStyle.Information, "Ah..."); } else { this.myPS.ImageName = str; this.DisplayIcon(); } } } }
public static void LoadPowersetImages() { I9Gfx.Powersets = new ExtendedBitmap(DatabaseAPI.Database.Powersets.Length * 16, 16); for (int index = 0; index <= DatabaseAPI.Database.Powersets.Length - 1; ++index) { int x = index * 16; string str = I9Gfx.GetPowersetsPath() + DatabaseAPI.Database.Powersets[index].ImageName; if (!File.Exists(str)) { str = I9Gfx.ImagePath() + "Unknown.png"; } using (ExtendedBitmap extendedBitmap = new ExtendedBitmap(str)) { if (extendedBitmap.Size.Height > 16 | extendedBitmap.Size.Width > 16) { I9Gfx.Powersets.Graphics.DrawImage((Image)extendedBitmap.Bitmap, x, 0, 16, 16); } else { I9Gfx.Powersets.Graphics.DrawImage((Image)extendedBitmap.Bitmap, x, 0); } } } }