小弟最近写了个俄罗斯方块游戏的代码
使用如下的图像显示代码
public void DisplayNow()//显示当前下落
{
Graphics g = this.pictureBox1.CreateGraphics();
GraphicsPath path = new GraphicsPath();
for (int z = 0; z < 4; z++)
{
if (tem.po[z].X != -100)
{
Rectangle rec = new Rectangle((tem.po[z].Y * 20), ( tem.po[z].X * 20), 20, 20);
path.AddRectangle(rec);
Point centerPoint = new Point(5 + tem.po[z].Y * 20, tem.po[z].Y * 20);
PathGradientBrush brush = new PathGradientBrush(path);
brush.CenterPoint = centerPoint;
brush.CenterColor = Color.Blue;
brush.SurroundColors = new Color[] { Color.White };
g.FillRectangle(brush, rec);
}
}
}
但无奈只要开始绘图就无法选中窗体,也不能按按钮,只能看着绘图在那刷新,方块照样落
请问这个要如何解决呢?
不甚感激
使用如下的图像显示代码
public void DisplayNow()//显示当前下落
{
Graphics g = this.pictureBox1.CreateGraphics();
GraphicsPath path = new GraphicsPath();
for (int z = 0; z < 4; z++)
{
if (tem.po[z].X != -100)
{
Rectangle rec = new Rectangle((tem.po[z].Y * 20), ( tem.po[z].X * 20), 20, 20);
path.AddRectangle(rec);
Point centerPoint = new Point(5 + tem.po[z].Y * 20, tem.po[z].Y * 20);
PathGradientBrush brush = new PathGradientBrush(path);
brush.CenterPoint = centerPoint;
brush.CenterColor = Color.Blue;
brush.SurroundColors = new Color[] { Color.White };
g.FillRectangle(brush, rec);
}
}
}
但无奈只要开始绘图就无法选中窗体,也不能按按钮,只能看着绘图在那刷新,方块照样落
请问这个要如何解决呢?
不甚感激
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货