Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

ImageAttributes isn't working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ryandailey21@hotmail.com - 30 Jun 2006 06:23 GMT
Hello,
For some reason this ImageAttributes isn't doing what I tell it.  I'm
not sure what I am missing.  I am trying to get background of the image
to display as transparent.  But it draws the image unchanged.  Here's
my code.

   Dim ImgColorMap(0) As System.Drawing.Imaging.ColorMap
       Dim BackColor As Color
       'Draw the Background
       graph.DrawImage(BackGroundImage, 0, 0)

       'Draw the board
       BackColor = BoardImages(0).GetPixel(0, 0)
       ImgColorMap(0) = New System.Drawing.Imaging.ColorMap
       ImgColorMap(0).OldColor = New Color
       ImgColorMap(0).OldColor.FromArgb(BackColor.A, BackColor.R,
BackColor.G, BackColor.B)
       ImgColorMap(0).NewColor = New Color
       ImgColorMap(0).NewColor.FromArgb(0, 0, BackColor.G, 0)
       BoardImageAttributes = New
System.Drawing.Imaging.ImageAttributes
       BoardImageAttributes.SetRemapTable(ImgColorMap)

       graph.DrawImage(BoardImages(0), New Rectangle(50, 50, 50, 50),
28, 28, 50, 50, GraphicsUnit.Pixel, BoardImageAttributes)
Barry Kelly - 30 Jun 2006 07:43 GMT
>         ImgColorMap(0).OldColor = New Color

This assigns an empty Color value to OldColor (i.e. black).

>         ImgColorMap(0).OldColor.FromArgb(BackColor.A, BackColor.R,
> BackColor.G, BackColor.B)

FromArgb returns the new value. It is a static method, so it does not
modify the Color value in the OldColor property itself. What you want is
more like:

         ImgColorMap(0).OldColor = Color.FromArgb(BackColor.A '...

-- Barry

Signature

http://barrkel.blogspot.com/

ryandailey21@hotmail.com - 30 Jun 2006 16:15 GMT
Okay,
I removed those New keywords for OldColor and NewColor.  I am still
getting a drawn image with no changed colors.
Does it make a difference that I am writing all this in a class and not
the form itself?
ryandailey21@hotmail.com - 02 Jul 2006 07:06 GMT
> Okay,
> I removed those New keywords for OldColor and NewColor.  I am still
> getting a drawn image with no changed colors.
> Does it make a difference that I am writing all this in a class and not
> the form itself?

I REPEAT.  IT DIDN'T WORK.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.