Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Deriving from System.Drawing.Image troubles...

Deriving from System.Drawing.Image troubles...

Scheduled Pinned Locked Moved C#
graphicshelpquestiondiscussioncareer
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Zinni
    wrote on last edited by
    #1

    Hey all, I'm trying to create a new EnhancedImage class derived from a System.Drawing Image class, but I keep getting the error "System.Drawing.Image.Image()' is inaccessible due to its protection level". Is it possible that you just can't derive from this class? I posted my code for the class below. It's pretty simple so far, just a constructor. Any thoughts would be appreciated. Thanks. using System; using System.Drawing; namespace WindowsApplication1 { /// /// Summary description for EnhancedImage. /// public class EnhancedImage : Image { public EnhancedImage(string imageFilename) { FromFile(imageFilename); } } } -Mike Zinni "No shit it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."

    K 1 Reply Last reply
    0
    • M Mike Zinni

      Hey all, I'm trying to create a new EnhancedImage class derived from a System.Drawing Image class, but I keep getting the error "System.Drawing.Image.Image()' is inaccessible due to its protection level". Is it possible that you just can't derive from this class? I posted my code for the class below. It's pretty simple so far, just a constructor. Any thoughts would be appreciated. Thanks. using System; using System.Drawing; namespace WindowsApplication1 { /// /// Summary description for EnhancedImage. /// public class EnhancedImage : Image { public EnhancedImage(string imageFilename) { FromFile(imageFilename); } } } -Mike Zinni "No shit it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."

      K Offline
      K Offline
      krisp
      wrote on last edited by
      #2

      I have no idea if this would work, but possibly the Image abstract class has its default constructor as private and that is what you are calling, so it may require that you use one of its defined constructors, and I noticed the Bitmap class does not use a default contructor either. I think this would work... if it doesn't, then i have no idea. notice this line: public EnhancedImage(string imageFilename) : base( imageFileName ) using System; using System.Drawing; namespace WindowsApplication1 { /// /// Summary description for EnhancedImage. /// public class EnhancedImage : Image { public EnhancedImage(string imageFilename) : base( imageFileName ) { FromFile(imageFilename); } } }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups