transparent

main
syneffort 2 years ago
parent 391f3c3ce5
commit 6379d0aaf1
  1. 17
      PngToIco/PngToIco/MainForm.cs

@ -23,10 +23,19 @@ namespace PngToIco
private Icon ConvertToIcon(Image image)
{
Image resizedImage = image.GetThumbnailImage(64, 64, null, new IntPtr());
Bitmap bitmap = new Bitmap(resizedImage);
bitmap.SetResolution(64, 64);
Icon icon = Icon.FromHandle(bitmap.GetHicon());
//Image resizedImage = image.GetThumbnailImage(64, 64, null, new IntPtr());
//Bitmap bitmap = new Bitmap(resizedImage);
//bitmap.MakeTransparent(Color.FromArgb(0, 255, 0));
//bitmap.SetResolution(64, 64);
//Icon icon = Icon.FromHandle(bitmap.GetHicon());
//return icon;
Bitmap bitmap = new Bitmap(image);
bitmap.MakeTransparent(Color.FromArgb(0, 255, 0));
Bitmap resized = new Bitmap(bitmap, new Size(256, 256));
resized.SetResolution(256, 256);
Icon icon = Icon.FromHandle(resized.GetHicon());
return icon;
}

Loading…
Cancel
Save