コード例 #1
0
ファイル: EditorDLC.cs プロジェクト: Shadowth117/sa_tools
 private void buttonLoadIcon_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog od = new OpenFileDialog()
     {
         DefaultExt = "bmp", Filter = "Bitmap Files|*.bmp;*.png;*.jpg;*.gif|All Files|*.*"
     })
         if (od.ShowDialog(this) == DialogResult.OK)
         {
             Bitmap bitmap = new Bitmap(od.FileName);
             if (bitmap.PixelFormat != PixelFormat.Format4bppIndexed)
             {
                 var quantizer = new PnnQuant.PnnQuantizer();
                 bitmap = quantizer.QuantizeImage(bitmap, PixelFormat.Format4bppIndexed, 16, true);
             }
             meta.Icon = bitmap;
             pictureBoxDLCicon.Image = ScalePreview(meta.Icon, pictureBoxDLCicon, checkBoxZoom.Checked);
         }
 }