Hi all
Ok first of me new to C#sharp. At the moment I am still learning the language. The problem I am running into is that I just can't seem to get a picture embedded into my program and then read it. Everytime I get a error from the debugger. I tried all kinds of thinks but can figure out what is going wrong. Using the C#builder from Borland I get it working, but not with VS. What am I doing wrong ? I included the program so you can see what I did. the line marked with ==> is where the debugger holds
using System.Drawing
using System.Reflection
using System.Windows.Forms
using System.Resources
namespace Apple
public class Programma: System.Windows.Forms.Form
private System.Drawing.Image buffer
private System.Drawing.Graphics display
public Programma()
InitializeComponent()
private void InitializeComponent()
SetStyle(System.Windows.Forms.ControlStyles.UserPa int, true)
SetStyle(System.Windows.Forms.ControlStyles.AllPai ntingInWmPaint, true)
SetStyle(System.Windows.Forms.ControlStyles.Double Buffer, true)
ClientSize = new Size(392, 60)
buffer = new System.Drawing.Bitmap(392, 60)
display = System.Drawing.Graphics.FromImage(buffer)
new System.Threading.Thread(new System.Threading.ThreadStart(Animation_Start)).Sta rt()
private void Animation_Start()
Assembly assembly = Assembly.GetExecutingAssembly()
==> Image image = Image.FromStream(assembly.GetManifestResourceStrea m "Apple.Bitmap1.bmp"))
Bitmap bitmap = new Bitmap(56, 60)
Graphics graphics = Graphics.FromImage(bitmap)
graphics.DrawImage(image, -338, 0)
display.DrawImage(bitmap, 0, 0)
Refresh()
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
System.Drawing.Graphics g = e.Graphics
g.DrawImage(buffer, 0, 0)
base.OnPaint(e)
public static void Main()
System.Windows.Forms.Application.Run(new Programma())
System.Environment.Exit(0)
}