473,581 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't inherit from System.Drawing. Image

J
I tried to inherit 'Shot' class from 'Image' class, only to fail.
It gives me the CS0122 error, which says that it can't access
'System.Drawing .Image.Image()' .

What am I missing?

using System;

namespace Vol
{
public class Shot : System.Drawing. Image
{
public Shot() // CS0122 - can't access System.Drawing. Image.Image()
{
}
}
}
Jul 13 '06 #1
3 8920
J
Somebody told me that the 'Image' class sets the c'tor as internal, so only
the classes inside System.Drawing dll assembly can inherit from 'Image',
such as 'Bitmap'.

If this is true, there is no way to inherit from System.Drawing. Image?

Sorry if the question is not clear, it's because I'm a beginner with C#.
:-)

J <krazou@yahoo_c o_krwrote in
news:Xn******** *************** **@207.46.248.1 6:
I tried to inherit 'Shot' class from 'Image' class, only to fail.
It gives me the CS0122 error, which says that it can't access
'System.Drawing .Image.Image()' .

What am I missing?

using System;

namespace Vol
{
public class Shot : System.Drawing. Image
{
public Shot() // CS0122 - can't access
System.Drawing. Image.Image() {
}
}
}
Jul 13 '06 #2
"J" <krazou@yahoo_c o_kra écrit dans le message de news:
Xn************* ************@20 7.46.248.16...

|I tried to inherit 'Shot' class from 'Image' class, only to fail.
| It gives me the CS0122 error, which says that it can't access
| 'System.Drawing .Image.Image()' .
|
| What am I missing?

Image is an abstract class that is only intended to be derived from
internally.

You should write a wrapper class that holds either a Bitmap or Metafile;
both of which derive from Image.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Jul 13 '06 #3
No you can't inherit from it. I tried and can't even compile. Err: has no
constructors defined

Probably you can use it with need to inherit it.

chanmm
"J" <krazou@yahoo_c o_krwrote in message
news:Xn******** *************** **@207.46.248.1 6...
Somebody told me that the 'Image' class sets the c'tor as internal, so
only
the classes inside System.Drawing dll assembly can inherit from 'Image',
such as 'Bitmap'.

If this is true, there is no way to inherit from System.Drawing. Image?

Sorry if the question is not clear, it's because I'm a beginner with C#.
:-)

J <krazou@yahoo_c o_krwrote in
news:Xn******** *************** **@207.46.248.1 6:
>I tried to inherit 'Shot' class from 'Image' class, only to fail.
It gives me the CS0122 error, which says that it can't access
'System.Drawin g.Image.Image() '.

What am I missing?

using System;

namespace Vol
{
public class Shot : System.Drawing. Image
{
public Shot() // CS0122 - can't access
System.Drawing. Image.Image() {
}
}
}

Jul 13 '06 #4

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

Similar topics

7
14198
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method, then use the GetThumbnailImage method to create a second Image. This second one is the one I want to get a FileStream from, so that I can then use...
2
6265
by: PJ | last post by:
Hi I was developing a Class for skinning an application. IN order to read the image file dynamically I used System.Drawing.Image.FromFile("..."). Strangely VS 2003 returns an error saying that "FromFile is not a member of the System.Drawing.Image". According to the member list under IMage class that is not true. I am completely baffled by...
2
2246
by: andycool1 | last post by:
I get the following error in my code when I set Option Strict to On: Option Strict On disallows implicit conversions from 'System.Object' to 'System.Drawing.Image' The blue error underline starts at "ResMan" and goes to the end of the line in this line of code: Dim i As System.Drawing.Image = ResMan.GetObject("logo.gif") ResMan is...
5
2313
by: benoit | last post by:
Hi, I have this question. When I use the FileUpload WebControl to post an Image (= SourceFile) that I want to resize and write to the server, I keep getting this situation. If that SourceFile is located in My Documents (as in "C:\Documents and Settings\29\Mijn documenten\SubFolderFolder\ImgName.jpg"), I keep getting a...
4
3632
by: Darrel | last post by:
I'm grabbing a file from a file upload form field. This is a 'system.web.httppostedfile' I would like to modify the image (Cropping/scaling) using system.drawing.image. Is there anyway to go from 'system.web.httppostedfile' directly to 'system.drawing.image'? Normally, I'd grab the System.Drawing.Image from a file itself:
5
3356
by: Jerry J | last post by:
I want to use the System.Drawing.Image class. According to the help file, this is an abstract base class. Because it is supposedly abstract, I created another class that inherits from it. However, when I did this I got the following error: 'System.Drawing.Image.Image()' is inaccessible due to its protection level Looking at other online...
7
4798
by: bookon | last post by:
I was running into the System.Drawing.Image.FromStream "parameter is not valid" on some of the images I was retrieving from a blob column in Sql Server. I thought there were corrupt images as almost all worked (all are gifs), and only a few broke when this line ran: Image img = Image.FromStream(ms); here is the original code: b =...
3
6423
by: Dave Keen | last post by:
Hi all. Hope you can help me. This should be easy but I can't make this work. In brief I am building a page of thumbnails using images held in a SQLServer 2000 database. I do this by creating imagebuttons which point to a dummy page that takes the image and displays it via response. All works fine if I use explicit paths to a file...
9
5039
by: Eric | last post by:
Hi Everyone, I'm writing a UserControl that exposes a property of the type System.Drawing.Image, like this: Public Property DefaultImage() As Image Get Return propDefaultImage End Get Set(ByVal Value As Image)
0
7862
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...
0
7789
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...
1
7894
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...
0
8169
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...
0
6551
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5361
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...
0
3803
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1400
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1132
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.