You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

C# Windows Forms中解决教授精灵生成重叠问题的求助

C# Windows Forms游戏生成敌方精灵重叠问题求助

我在开发C# Windows Forms游戏时遇到了一个问题:生成的教授精灵(用PictureBox实现)会互相重叠,实际运行截图显示本应生成的5个敌方角色出现了重叠情况。尝试过多种方案仍未解决,恳请提供帮助。

相关代码如下:

private void MakeProf()
{
    PictureBox prof = new PictureBox();
    prof.Tag = "prof";
    prof.Image = Image.FromFile("pdown.png"); //picture of the prof facing down (pdown.png)
    prof.Left = randNum.Next(0, 1400); //how far the prof will spawn
    prof.Top = randNum.Next(0, 800);
    prof.Size = new Size(110, 110); //size of the prof
    prof.SizeMode = PictureBoxSizeMode.Zoom;
    profList.Add(prof);
    this.Controls.Add(prof);
    player.BringToFront(); //overlaps the player
}

截图:
本应生成5个敌方角色却出现重叠的游戏界面

内容的提问来源于stack exchange,提问作者Jay Delos Santos

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 01:40:51