如图,我用代码绘制了这样一个界面,但是在拖动滚动条的时候会出现界面撕裂的情况
请教这个应该怎么处理?
代码如下:
[C#] 纯文本查看 复制代码 public void ShowHeroes(string herotype)
{
var heros=_apricot.AllHeroes();
var i=0;
foreach (var item in heros)
{
SetHero(item, i);
i++;
}
}
public void SetHero(Hero hero, int count)
{
var herologo=new SkinPictureBox();
var heroname=new SkinLabel();
var heropanel=new SkinPanel();
heropanel.Controls.Add(heroname);
heropanel.Controls.Add(herologo);
BackPanel.Controls.Add(heropanel);
herologo.BackColor = Color.Transparent;
herologo.Size = new Size(64, 64);
herologo.Location = new Point(5, 5);
herologo.BackgroundImageLayout = ImageLayout.Zoom;
herologo.BackgroundImage = Picture.HeroSquare(hero.EnName);
heroname.BackColor = Color.Transparent;
heroname.BorderColor = Color.White;
heroname.Location = new Point(0, 69);
heroname.Size = new Size(74, 20);
heroname.TextAlign = ContentAlignment.MiddleCenter;
heroname.Text = hero.ChName;
heroname.Font = new Font("微软雅黑", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134)));
heropanel.BackColor = Color.FromArgb(70, Color.White);
heropanel.ControlState = CCWin.SkinClass.ControlState.Normal;
heropanel.Visible = true;
heropanel.Size = new Size(74, 90);
int row=count/7;
int comn=count%7;
heropanel.Location = new Point(6 + 88 * comn, 12 + 94 * row);
}
|