내 다이아몬드 게임에 다이아몬드 세트를 표시하려고합니다. 다 괜찮아 보이지만 굵게 (또는 2 **) 넣어 라인에 대한 'NullReferenceException'오류가 발생합니다. 이 프로젝트는 Descending Diamonds라고하며 이미지는 그래픽 폴더에 있습니다.NullReferenceException
누구나 사물에 대해 밝힐 수 있습니까? GameGraphics.Clear()가 폭격하지 않기 때문에
// Initialize graphics library.
// Which graphics set are we using?
if (GameForm.ClientRectangle.Height < 480)
{
// The screen height is insufficient for the large graphics set,
// so load the small graphics
GameGraphics.Clear();
**GameGraphics.Add("Diamonds", new Bitmap(asm.GetManifestResourceStream("DecendingDiamonds.Graphics.SmallDiamonds.png")));**
_diamondWidth = 21;
_diamondHeight = 16;
}
else
{
// We have enough space to use the large graphics set
GameGraphics.Clear();
**GameGraphics.Add("Diamonds", new Bitmap(asm.GetManifestResourceStream("DecendingDiamonds.Graphics.BigDiamonds.png")));**
_diamondWidth = 42;
_diamondHeight = 32;
}
GameGraphics 변수를 구성 했습니까? –
나는 그가 GameGraphics 변수를 만들었다 고 생각한다. 그렇지 않으면 그는 동일한 객체에 대해 Clear 메소드를 호출하기 전에 그 라인에서 예외를 얻었을 것이다. – Lav
스택 추적을 게시 할 수 있습니까? –