以下代码为什么在Winform上什么都画不出来呢?
好像有点奇怪
protected override void OnPaint(PaintEventArgs e)
{
Point[] pts = new Point[6];
pts[0] = new Point(234,49);
pts[5] = new Point(234,171);
pts[1] = new Point(294,7);
pts[4] = new Point(294,213);
pts[2] = new Point(414,49);
pts[3] = new Point(414,171);
byte[] types = new byte[6];
types[0] = (byte)PathPointType.Start;
types[5] = (byte)PathPointType.CloseSubpath;
for(int i=1;i<5;i++)
{
types[i] = (byte)PathPointType.Line;
}
GraphicsPath shape = new GraphicsPath(pts,types);
Region rg = new Region(shape);
e.Graphics.FillRegion(Brushes.White,rg);
e.Graphics.DrawPath(Pens.White,shape);
}
好像有点奇怪
protected override void OnPaint(PaintEventArgs e)
{
Point[] pts = new Point[6];
pts[0] = new Point(234,49);
pts[5] = new Point(234,171);
pts[1] = new Point(294,7);
pts[4] = new Point(294,213);
pts[2] = new Point(414,49);
pts[3] = new Point(414,171);
byte[] types = new byte[6];
types[0] = (byte)PathPointType.Start;
types[5] = (byte)PathPointType.CloseSubpath;
for(int i=1;i<5;i++)
{
types[i] = (byte)PathPointType.Line;
}
GraphicsPath shape = new GraphicsPath(pts,types);
Region rg = new Region(shape);
e.Graphics.FillRegion(Brushes.White,rg);
e.Graphics.DrawPath(Pens.White,shape);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货