1. 透明图片绘制:
string str = DateTime.Now.ToString();
System.Drawing.Image image = new System.Drawing.Bitmap(200, 30, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(image);
string thefullname = "f:\\nowtime.png ";
g.Clear(Color.Transparent);
g.DrawString(str, new Font("Courier New ", 10), new
SolidBrush(Color.FromArgb(128, 0, 0, 255)), 20, 5);
image.Save(thefullname, System.Drawing.Imaging.ImageFormat.Png);
2.绘制圆柱体
Bitmap img = new Bitmap(100, 100); //图片大小
Graphics g = Graphics.FromImage(img);
Pen pen = new Pen(Color.DimGray);
SolidBrush brush = new SolidBrush(Color.LightGray);
int height = 60;
int width = 50;
int vHeigth = 100;
int vwidth = 30;
for (int i = height; i > 0; i--)
g.DrawEllipse(pen, 0, i, vHeigth, vwidth);
g.FillEllipse(brush, 0, 0, vHeigth, vwidth);
img.Save("f:\\ellipse.png");