473,395 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with resource picture

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)

}
Nov 16 '05 #1
1 1461
Extra info.

When I look in the soluction explore it says the following
Solution 'Apple' (1 project)
- Apple
+ References
App.ico
AssemblyInfo.cs
Bitmap1.bmp
Class1.cs
Form1.cs

Bardo
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: #Hai | last post by:
Hi, I have a picture box control in my form and I have 2 .GIF (animated GIF image). And I want to display those GIF image in my picture-box (at first, I want the control to show the first image...
3
by: J.Marsch | last post by:
Hello all: I am trying to build a resource dll that will house icons, and I'm afraid that I'm not having much luck reading it. Can you lend hand (or just point me to a good primer). Here's...
10
by: Saso Zagoranski | last post by:
hi, this is not actually a C# problem but since this is the only newsgroup I follow I decided to post my question here (please tell me where to post this next time if you think this post...
5
by: Jean Christophe Avard | last post by:
Hi! I am designing a database driven application. The main purpose of this application is to print signs and label with plant (botanical) information and a picture of the plant. This is mainly...
5
by: ma | last post by:
Hello, I am new in .NET and I am writing my first program in c++/CLI on MSVC 2005. I add a PictureBox to my form and then using its properties I change its image property to one image...
14
by: Jim Michaels | last post by:
mysql_query("START TRANSACTION", $link2); $q2=mysql_query("SELECT pictures.pid AS pid FROM pictures,counter WHERE pictures.pid>counter.pid LIMIT 1", $link2); if ($row2=mysql_fetch_assoc($q2)) {...
1
by: kenneth6 | last post by:
Give me some help, pls!! I am doing an image processing project. I decide to import some prepared binary images (in binary BMP format) into the resources sections of a MFC C++ project. The...
6
by: LEM | last post by:
Hi, I use a Webbrowser component to display a page that has been generate dynamically from my C# program. This page contains some images that are displayed using HTML code like this: <img...
5
by: Jeff Ciaccio | last post by:
I get an "Ambiguous Match Exception" when I try to run the code below. I need |x1 - x2| 80 and |y1 - y2| 100, and I want to just loop until this condition is true. horz1 = Int(Rnd() * 469)...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.