#region 給透明的png圖片加入白色底色 Image Image = Image.FromFile("路徑"); Bitmap pbitmap = new Bitmap(Image); Graphics g2 = Graphics.FromImage(Image); GraphicsPath gp = new GraphicsPath(); //新建圖像路徑來存儲透明的點 for (int x = 0; x < 60; x++) { for (int y = 0; y < 60; y++) { Color c = pbitmap.GetPixel(x, y); if (c.A == 0) { gp.AddRectangle(new Rectangle(x, y, 1, 1));//添加點到路徑 g2.DrawPath(Pens.White, gp); } else { } } } #endregion