110,499
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
//画布
Image bit = new Bitmap(100, 50);
//在画布上绘出字符串
Graphics g = Graphics.FromImage(bit);
//g.Clear(Color.Black);
g.DrawString("1234567", new Font("Arial", 12), new SolidBrush(Color.Gold), new PointF(0, 0));
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.Dispose();
//bit.MakeTransparent(Color.Black);
Graphics x = this.CreateGraphics();
//将画布绘制到控件上
x.DrawImage(bit, new Point(100, 50));
//将字符串直接绘制到控件上
x.DrawString("123567", new Font("Arial", 12), new SolidBrush(Color.Gold), new PointF(100, 80));
x.Dispose();
bit.Dispose();
}
private void button1_Click(object sender, EventArgs e)
{
Image bit = new Bitmap(100, 50);
Graphics g = Graphics.FromImage(bit);
g.Clear(Color.Black);
g.DrawString("1234567", new Font("Arial", 12), new SolidBrush(Color.Gold), new PointF(0, 0));
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.Dispose();
Graphics x = this.CreateGraphics();
x.DrawImage(bit, new Point(100, 50));
x.DrawString("1234567", new Font("Arial", 12), new SolidBrush(Color.Gold), new PointF(100, 80));
x.Dispose();
bit.Dispose();
}
//默认构造的位图背景色是黑色的
Image bit = new Bitmap(100, 50);
Graphics g = Graphics.FromImage(bit);
//用窗体背景色填充,再绘制字符串就得到和直接在窗体绘制的一样的了
g.Clear(this.BackColor);
//
//