相关代码如下,报错了,本人不知道错在哪里,求高手指点:
class Character { public string Name; public int Level; public int MaxHP; public int MaxMP; public int HP; public int MP; public int Atk; public int Def; public int M_Atk; public int M_Def; public int Agi; } // ShirouEmiyaState // this.ShirouEmiyaState.BackColor = System.Drawing.Color.Black; this.ShirouEmiyaState.ForeColor = System.Drawing.Color.White; this.ShirouEmiyaState.Location = new System.Drawing.Point(12, 49); this.ShirouEmiyaState.Multiline = true; this.ShirouEmiyaState.Name = "ShirouEmiyaState"; this.ShirouEmiyaState.Size = new System.Drawing.Size(218, 366); this.ShirouEmiyaState.TabIndex = 19; this.ShirouEmiyaState.Text = ShirouEmiya.HP .ToString (); this.ShirouEmiyaState.Visible = false; this.ShirouEmiyaState.TextChanged += new System.EventHandler(this.ShirouEmiyaState_TextChanged); //
再附上载图:
解决方案
40
ShirouEmiya为null或ShirouEmiya.HP 为null,你检查下看看是不是没有给它们赋值。还有一点很奇怪,你这一句
this.ShirouEmiyaState.Text = ShirouEmiya.HP .ToString ();
当中为什么有那么多空格。
this.ShirouEmiyaState.Text = ShirouEmiya.HP .ToString ();
当中为什么有那么多空格。