private void MakeButton_Click(object sender, EventArgs e) { if (!File.Exists(AFilename.Text)) { return; } if (BFilename.Text == "") { return; } if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } try { //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { DecreaseColor dc = new DecreaseColor(); Bitmap src = new Bitmap(AFilename.Text); int width = (int)this.ConvertWidth.Value; int height = (int)this.ConvertHeight.Value; int yohaku = (int)this.ConvertYohaku.Value; int paletteno = (int)this.ConvertPaletteNo.Value; bool isReserve1stColor = (this.ConvertReserveColor.SelectedIndex == 1); Bitmap src2; if (this.ConvertSizeMethod.SelectedIndex == 0) { src2 = ImageUtil.BitmapSizeChange(src, 0, 0, width, height); } else { src2 = ImageUtil.BitmapScale(src, width, height); } bool ignoreTSA = IgnoreTSA.Checked; Bitmap dest = dc.Convert(src2, paletteno, yohaku, isReserve1stColor, ignoreTSA); U.BitmapSave(dest, BFilename.Text); src.Dispose(); src2.Dispose(); dest.Dispose(); } //エクスプローラで選択しよう U.SelectFileByExplorer(BFilename.Text); } catch (System.Runtime.InteropServices.ExternalException ee) { R.ShowStopError(R.ExceptionToString(ee)); } catch (System.ArgumentOutOfRangeException ee) { R.ShowStopError(R.ExceptionToString(ee)); } }