Winform 绘制圆形的图片
string filename = "icon.png";//如果不是png类型,须转换 System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(filename); for (int y = 0; y < 100; y++) { for (int x = 0; x < 100; x++) { if ((x - 50) * (x - 50) + (y - 50) * (y - 50) > 50 * 50) { bitmap.SetPixel(x, y, System.Drawing.Color.FromArgb(0, 255, 255, 255)); } } } Graphics g = CreateGraphics(); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.DrawImage(bitmap, new Point(50, 50)); g.DrawEllipse(new Pen(Color.LightGray), 50, 50, 100, 100); g.Dispose();