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. getting a disabled picture

getting a disabled picture

Scheduled Pinned Locked Moved C#
graphicsalgorithmsquestion
2 Posts 1 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.
  • R Offline
    R Offline
    Rupel
    wrote on last edited by
    #1

    hi all, when i put a bitmap on a button and disable the control, the image is painted in a smooth gray-scale way. is there any chance to access the corresponding

    Image MakeMyImageGrayScale(Image my Image);

    function directly, giving it the colored image and getting back the grayscaled one? or is the algorithm easy, so that someone can describe it here in the forum or knows a link to a description? if someone tells me how, i would do that myself. would be :cool: thx in advance :wq

    R 1 Reply Last reply
    0
    • R Rupel

      hi all, when i put a bitmap on a button and disable the control, the image is painted in a smooth gray-scale way. is there any chance to access the corresponding

      Image MakeMyImageGrayScale(Image my Image);

      function directly, giving it the colored image and getting back the grayscaled one? or is the algorithm easy, so that someone can describe it here in the forum or knows a link to a description? if someone tells me how, i would do that myself. would be :cool: thx in advance :wq

      R Offline
      R Offline
      Rupel
      wrote on last edited by
      #2

      ok, i wrote my own:

      Image ImageToGrayScale(Image orig)
      {
      Bitmap bm = new Bitmap(orig);
      for (int i=0; i<bm.Width; ++i)
      for (int j=0; j<bm.Height; ++j)
      {
      Color pixel = bm.GetPixel(i,j);
      if (pixel.A>0)
      {
      int grayVal = 175+(pixel.R+pixel.G+pixel.B)/12;
      bm.SetPixel(i,j,Color.FromArgb(grayVal,grayVal,grayVal));
      }
      }
      return bm;
      }

      :rolleyes: :wq

      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