473,778 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Reflecti on
using System.Windows. Forms
using System.Resource s

namespace Apple

public class Programma: System.Windows. Forms.Form

private System.Drawing. Image buffer
private System.Drawing. Graphics display
public Programma()
InitializeCompo nent()
private void InitializeCompo nent()
SetStyle(System .Windows.Forms. ControlStyles.U serPaint, true)
SetStyle(System .Windows.Forms. ControlStyles.A llPaintingInWmP aint, true)
SetStyle(System .Windows.Forms. ControlStyles.D oubleBuffer, true)
ClientSize = new Size(392, 60)
buffer = new System.Drawing. Bitmap(392, 60)
display = System.Drawing. Graphics.FromIm age(buffer)
new System.Threadin g.Thread(new System.Threadin g.ThreadStart(A nimation_Start) ).Start()
private void Animation_Start ()
Assembly assembly = Assembly.GetExe cutingAssembly( )
==> Image image = Image.FromStrea m(assembly.GetM anifestResource Stream "Apple.Bitmap1. bmp"))
Bitmap bitmap = new Bitmap(56, 60)
Graphics graphics = Graphics.FromIm age(bitmap)
graphics.DrawIm age(image, -338, 0)
display.DrawIma ge(bitmap, 0, 0)
Refresh()
protected override void OnPaint(System. Windows.Forms.P aintEventArgs e)
System.Drawing. Graphics g = e.Graphics
g.DrawImage(buf fer, 0, 0)
base.OnPaint(e)
public static void Main()
System.Windows. Forms.Applicati on.Run(new Programma())
System.Environm ent.Exit(0)

}
Nov 16 '05 #1
1 1477
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
4444
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 and a few seconds later, I want the control to present the second image). The following are some ways I have try to deal with this task: - Insert two picture-box control into my form and each control shows only one image; and then, I will toggle...
3
10384
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 what I've done so far: (VS.NET 2003/C#) 1. Created an empty project for the resource dll. Output type is class library.
10
2139
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 shouldn't be here). I have two design questions: 1. what is the correct (or best) way to include database queries into the code if you plan on
5
1829
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 intended for the nurseries. Our application comes with 3500+ full plants description and hi-res picture for each one, while the end user can add his own into the db. However, my boss don't want the end user to have directly access to the picture (the...
5
1747
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 from my hard disk. it generate the following code for me:
14
1808
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)) { mysql_query("UPDATE counter SET pid=$row2", $link2); $n=$row2; } else { //reached end of table. mysql_query("UPDATE counter SET pid=1", $link2);
1
1790
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 function I want is actually to get the binary pixel to the (array??) and then setpixel (draw) after processing an image. (i.e. two images, one original one processed, are shown on the window at the same time) I found some classes that may be helpful to me...
6
6488
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 src="person.gif"> person.gif is an image that is located in my bin folder.
5
1684
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) vert1 = Int(Rnd() * 245) Do horz2 = Int(Rnd() * 469) vert2 = Int(Rnd() * 245)
0
9629
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9465
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10127
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10068
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7474
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.