怎么在PICTUREBOX 里面画图?

xuanyuan05 2009-06-22 06:11:35
我把代码放在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);//绘制文本

}

...全文
249 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
格拉 2009-06-22
  • 打赏
  • 举报
回复
0.0
-
xuanyuan05 2009-06-22
  • 打赏
  • 举报
回复
怎么让鼠标能拖动所画的图
xuanyuan05 2009-06-22
  • 打赏
  • 举报
回复
果然行了 呵呵 谢谢
cnming 2009-06-22
  • 打赏
  • 举报
回复
picturebox有加载图片文件的属性,直接加载就可以了

如果你要自己画的话,必须使用e.Graphics
zgke 2009-06-22
  • 打赏
  • 举报
回复
...你刷子创建的是窗体的


System.Drawing.Graphics formGraphics =e.Graphics;


这样看看.

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧