[求助]画两个五角形
try{
Graphics grfx=this.CreateGraphics();
int cx=1;
int cy=1;
Pen pen=new Pen(Color.Blue,1);
Brush brush=new SolidBrush(Color.Red);
Point [] apt=new Point[5];
for(int i=0;i<apt.Length;i++)
{
double dAngle=(i*0.8-0.5)*Math.PI;
apt[i]=new Point((int)(cx*(0.25+0.24*Math.Cos(dAngle))),(int)(cy*(0.50+0.48*Math.Sin(dAngle))));
}
grfx.FillClosedCurve(brush,apt,FillMode.Alternate,0.1f);
for(int i=0;i<apt.Length;i++)
apt[i].X +=cx/2;
grfx.FillClosedCurve(brush,apt,FillMode.Winding,0.1f);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
感觉没有错,可运行时,出不来结果,并且没有错误生成,还望大家帮忙!看看是什么原因!
(此代码写在button的Click事件中)