想重写个OnPaint的函数怎么写?? 继承picturebox,然后重载Paint函数。OverRide 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class myPictureBox : System.Windows.Forms.PictureBox { public myPictureBox() { } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); } } 还是不懂protected override void OnPaint(PaintEventArgs e) { Graphics g= e.Graphics; g.FillRectangle(Brushes.White,this.ClientRectangle); GraphicsPath gp=new GraphicsPath(); gp.AddEllipse(20, 20, 300, 200); gp.AddPie(50, 100, 300, 100, 45, 200); gp.AddRectangle(new Rectangle(100, 30, 100, 80)); g.DrawPath(Pens.Blue, gp); g.TranslateTransform(200, 20); g.FillPath(Brushes.GreenYellow, gp); gp.Dispose(); }这个是画在form上的,怎样才能将它画在picturebox上?? 你重写System.Windows.Forms.PictureBox就是画在PictureBox上罗public class myPictureBox : System.Windows.Forms.PictureBox{...protected override void OnPaint(PaintEventArgs e){...} C# 打印预览和实际打印位置 有偏差 谁能帮我解决? 我想往数据库插入 日期字段 XML的问题 求计算生辰八字的算法。。。 MDI窗体标题栏不合并 sql 表于表之间批量复制数据时出错 求分布式数据采集方案 (菜鸟问题)怎么设置快捷键 求助个问题! ASP.NET 连接本地SQL SERVER问题-WINDOWS集成验证 人手不够,欢迎精通VB、熟练C#优秀人士加盟,有要跳槽的过来看看。上海。 马上要用c#了,请给推荐一本入门的书!
{
public myPictureBox()
{ } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
} }
protected override void OnPaint(PaintEventArgs e)
{
Graphics g= e.Graphics;
g.FillRectangle(Brushes.White,this.ClientRectangle);
GraphicsPath gp=new GraphicsPath();
gp.AddEllipse(20, 20, 300, 200);
gp.AddPie(50, 100, 300, 100, 45, 200);
gp.AddRectangle(new Rectangle(100, 30, 100, 80));
g.DrawPath(Pens.Blue, gp);
g.TranslateTransform(200, 20);
g.FillPath(Brushes.GreenYellow, gp);
gp.Dispose();
}
这个是画在form上的,怎样才能将它画在picturebox上??
public class myPictureBox : System.Windows.Forms.PictureBox
{...
protected override void OnPaint(PaintEventArgs e)
{...}