Thats kewl,
Could you explain the implicit operator a bit more Ive never seen it used
and I want to make sure I fully understand it before I go ahead and use it.
"Chris Taylor" <chris_taylor_za@hotmail.com> wrote in message
news:eE$wYqq0DHA.556@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi,
>
> I did the following little test to confirm my previous post.
>
> class MyImage
> {
> private string _fileName;
> private Bitmap _bitmap;
>
> public MyImage( string fileName )
> {
> _fileName = fileName;
> }
>
> public static implicit operator Image( MyImage o )
> {
> if ( o._bitmap == null )
> o._bitmap = new Bitmap( o._fileName );
>
> return o._bitmap;
> }
> }
>
> Then in my Paint event handler
>
> MyImage img = new MyImage("c:\\winnt\\Soap Bubbles.bmp");
> e.Graphics.DrawImage( img, 0, 0 );
>
> Hope this helps
>
> --
> Chris Taylor
>
http://www.xanga.com/home.aspx?user=taylorza
> "Chris Taylor" <chris_taylor_za@hotmail.com> wrote in message
> news:eI0Dxlq0DHA.3140@tk2msftngp13.phx.gbl...[color=green]
> > Hi,
> >
> > The constructor of the Image class is internal, that way any classes[/color]
> within[color=green]
> > the same Assembly such as Bitmap can happily derive from image. What[/color][/color]
might[color=blue][color=green]
> > be an option for you (And I have not tried this!), is to write your own
> > class Targa, then to provide a implicit cast operator for Image or[/color][/color]
Bitmap.[color=blue][color=green]
> > That way you can pass your class into functions that require a Image. I[/color]
> will[color=green]
> > do a test to see if something like this will work and post my results[/color]
> here.[color=green]
> >
> > Hope this helps
> >
> > --
> > Chris Taylor
> >
http://www.xanga.com/home.aspx?user=taylorza
> > "Dave Quigley" <merlin at countercultured dot net> wrote in message
> > news:OQn82Xq0DHA.3496@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > I realized that while looking through the documentation so I must be[/color]
> > missing[color=darkred]
> > > something then... This is what I have for the class declaration
> > >
> > > public class Targa : Image
> > > {
> > > public Targa()
> > > {
> > > }
> > > }
> > > Very simple but its giving me this error.
> > >
> > >
> > > System.Drawing.Image.Image() is inaccessable due to its protection[/color][/color]
> level.[color=green]
> > Im[color=darkred]
> > > not quite sure why its looking for this constructor since the base[/color][/color][/color]
class[color=blue][color=green]
> > is[color=darkred]
> > > abstract so it shouldent exist.
> > >
> > > This does however pose a problem. If I inherit from Image which seems[/color][/color][/color]
to[color=blue]
>[color=green]
> > be[color=darkred]
> > > the best Idea how do I go about getting the information to the graphic
> > > object properly... I was thinking a bitmap data object internally[/color][/color][/color]
which[color=blue]
> I[color=green][color=darkred]
> > > can probably just pass to be drawn.. That makes the most sense to[/color][/color][/color]
me...[color=blue][color=green]
> > Its[color=darkred]
> > > either do it this way or write Targa as a wrapper around Bitmap for[/color]
> > encoding[color=darkred]
> > > and decoding targas. Im not quite sure the best way to do this.
> > >
> > >
> > > "Chris Taylor" <chris_taylor_za@hotmail.com> wrote in message
> > > news:OK0EWLq0DHA.208@TK2MSFTNGP12.phx.gbl...
> > > > The .NET Image class is not sealed.
> > > >
> > > > --
> > > > Chris Taylor
> > > >
http://www.xanga.com/home.aspx?user=taylorza
> > > > "Dave Quigley" <merlin at countercultured dot net> wrote in message
> > > > news:uKmm3%23p0DHA.1760@TK2MSFTNGP10.phx.gbl...
> > > > > Hello everyone.... Im currently starting my targa support project[/color]
> > again[color=darkred]
> > > > for
> > > > > .NET and I am wondering if there are any particular interfaces or
> > > classes
> > > > > that Im supposed to extend in order to do this in a propper[/color][/color][/color]
manner.[color=blue]
> I[color=green][color=darkred]
> > > > could
> > > > > try to replicate Bitmap however I believe the problem I ran into[/color][/color][/color]
was[color=blue][color=green][color=darkred]
> > > that
> > > > > the base classes for images are sealed in .net so I cant inherit[/color][/color]
> from[color=green][color=darkred]
> > > > > them... Any suggestions would be greatly apprectiated. I may[/color][/color]
> consider[color=green][color=darkred]
> > > > adding
> > > > > things like psd support also later down the line so I want to come[/color][/color]
> up[color=green][color=darkred]
> > > with
> > > > a
> > > > > system now.
> > > > >
> > > > > Dave Quigley
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]