我把代码放在pictureBox的Paint事件里面 不能显示出图来
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{ System.Drawing.Graphics formGraphics = this.CreateGraphics();
string drawString = "Text";
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
float x = 250.0f;
float y = 200.0f;
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat(StringFormatFlags.DirectionVertical);//文本
formGraphics.DrawString(drawString, drawFont, drawBrush, x, y);//绘制文本 }
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{ System.Drawing.Graphics formGraphics = this.CreateGraphics();
string drawString = "Text";
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
float x = 250.0f;
float y = 200.0f;
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat(StringFormatFlags.DirectionVertical);//文本
formGraphics.DrawString(drawString, drawFont, drawBrush, x, y);//绘制文本 }
System.Drawing.Graphics formGraphics =e.Graphics;
这样看看.