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 / Compact Framework / February 2005

Tip: Looking for answers? Try searching our database.

How do draw an image in a disabled state?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan - 18 Feb 2005 21:53 GMT
Hi everyone

Does anyone know how to draw an image in a disabled state on the compact
framework?
I have created a dropdown button akin to the forward and back button in IE
but I'm stuck when it comes to putting the button in a disabled state.

Any help would be much appreciated.
Thanks in advance
Dan
Daniel Moth - 18 Feb 2005 23:54 GMT
The Control.Enabled property (=false) should do it...  or just create a copy
of your image replacing all white with the light grey and every other color
with dark grey.

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

> Hi everyone
>
[quoted text clipped - 6 lines]
> Thanks in advance
> Dan
Dan - 19 Feb 2005 01:36 GMT
Arh I did wonder if the easiest way would just be to have a copy of the
image, I know how to do it in the full framework for changing it on the fly
on just one image.

Dan

> The Control.Enabled property (=false) should do it...  or just create a
> copy of your image replacing all white with the light grey and every other
[quoted text clipped - 16 lines]
>> Thanks in advance
>> Dan
Sergey Bogdanov - 19 Feb 2005 09:25 GMT
So it will get like disabled, convert a certain Image as grayscale by
computing Y value (is the grayscale component in YIQ) by this formula:

Y = 0.299 * R + 0.587 * G + 0.114 * B

and then use Y value as R, G, B parameters for a color. See the code
snippet bellow, "dst" variable will contain grayscale image from
"source" bitmap:

Bitmap dst = new Bitmap(source.Width, source.Height);

for(int y=0; y < dst.Height;y++)
{
    for(int x=0; x < dst.Width; x++)
    {
        Color c = source.GetPixel(x, y);
        // alternatively Y = (77 * c.R + 150 * c.G + 29 * c.B) >> 8
        int Y = (int)(c.R * 0.299 + c.G * 0.587 + c.B * 0.114);
        dst.SetPixel(x, y, Color.FromArgb(Y, Y, Y));
    }
}

Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com

> Hi everyone
>
[quoted text clipped - 6 lines]
> Thanks in advance
> Dan
Dan - 19 Feb 2005 10:00 GMT
Hi Sergey

That worked first time thats brilliant, thanks a lot.

Thanks again
Dan

> So it will get like disabled, convert a certain Image as grayscale by
> computing Y value (is the grayscale component in YIQ) by this formula:
[quoted text clipped - 33 lines]
>> Thanks in advance
>> Dan

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.