PC Review


Reply
Thread Tools Rate Thread

Can't inherit from System.Drawing.Image

 
 
J
Guest
Posts: n/a
 
      13th Jul 2006
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()
{
}
}
}
 
Reply With Quote
 
 
 
 
J
Guest
Posts: n/a
 
      13th Jul 2006
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_co_kr> wrote in
news:Xns97FFA2821C50Bkrazouyahoo@207.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?
>
>
>
> using System;
>
> namespace Vol
> {
> public class Shot : System.Drawing.Image
> {
> public Shot() // CS0122 - can't access
> System.Drawing.Image.Image() {
> }
> }
> }


 
Reply With Quote
 
Joanna Carter [TeamB]
Guest
Posts: n/a
 
      13th Jul 2006
"J" <krazou@yahoo_co_kr> a écrit dans le message de news:
Xns97FFA2821C50Bkrazouyahoo@207.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


 
Reply With Quote
 
chanmm
Guest
Posts: n/a
 
      13th Jul 2006
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_co_kr> wrote in message
news:Xns97FFAA5074B1Dkrazouyahoo@207.46.248.16...
> 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_co_kr> wrote in
> news:Xns97FFA2821C50Bkrazouyahoo@207.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?
>>
>>
>>
>> using System;
>>
>> namespace Vol
>> {
>> public class Shot : System.Drawing.Image
>> {
>> public Shot() // CS0122 - can't access
>> System.Drawing.Image.Image() {
>> }
>> }
>> }

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mirror / rotate image ( System.Drawing.Graphics / System.Drawing.Drawing2D.Matrix) Eduard Witteveen Microsoft C# .NET 3 17th Jul 2006 01:26 PM
system.drawing.image to system.web.ui.webcontrols.image byrd48 Microsoft ASP .NET 0 6th Jul 2006 05:02 AM
System.drawing.image =?Utf-8?B?YmVub2l0?= Microsoft ASP .NET 5 23rd Jan 2006 01:00 PM
Resizing System.Drawing.Image David Dvali Microsoft C# .NET 1 28th Sep 2005 07:51 PM
StdPicture to System.Drawing.Image ??? Curtis Tammany Microsoft Dot NET 0 9th Oct 2003 07:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:48 AM.