C# Object reference not set to an instance of an object im Resources Menü :/?

... komplette Frage anzeigen

2 Antworten

Die fehlt eine Objektinstanz. Poste Deinen Code, dann finden wir eine Lösung.

Kommentar von DerJuliens
25.06.2016, 17:15

namespace DNGN
{
partial class GameWindow
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.canvas = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// canvas
//
this.canvas.Dock = System.Windows.Forms.DockStyle.Fill;
this.canvas.Location = new System.Drawing.Point(0, 0);
this.canvas.Name = "canvas";
canvas.Size = new System.Drawing.Size(Game.CANVAS_WIDTH, Game.CANVAS_HEIGHT);
this.canvas.TabIndex = 0;
this.canvas.Paint += new System.Windows.Forms.PaintEventHandler(this.canvas_Paint);
//
// GameWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(Game.CANVAS_WIDTH, Game.CANVAS_HEIGHT);
this.Controls.Add(this.canvas);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "GameWindow";
this.Text = "DNGN Pre_Alpha";
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel canvas;
}
}

da drin werden diese drei info symbole angezeigt

0
Kommentar von DerJuliens
25.06.2016, 17:17

und hier ist das mit dem Canvas zeug :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace DNGN
{
class Game
{

public const int CANVAS_HEIGHT = 700;
public const int CANVAS_WIDTH = 1200;
private GraphicsEngine gEngine;

public void startGraphics(Graphics g)
{
gEngine = new GraphicsEngine(g);
gEngine.rendering = true;
gEngine.init();
}

public void stopGame()
{
gEngine.stopRender();
}

}
}

0
Kommentar von Orsovai
25.06.2016, 19:42

Welche Zeile gibt den Fehler aus?

0

Was soll es sein wenns fertig ist ?

Kommentar von DerJuliens
25.06.2016, 17:14

ein spiel ! :D

0

Was möchtest Du wissen?