Locked Adjusting Brightness of a form

  • Monday, August 20, 2012 1:48 PM
     
     

    Hi all,

    I am developing a game where the form would dim periodically.

    How do I achieve the dimming effect?

    Please advise. All forums only talk about dimming the image (i.e. .bmp etc)

    Thanks a lot!

All Replies

  • Monday, August 20, 2012 10:51 PM
     
     Answered

    Hi,

    what do you mean with dimming the form? Dimming the BackColor? Dimming the BackColor of the Form and of all child-controls? Something else?

    Basically it is a color-related task. You will have to get the luminance of the currrent color, reduce this luminance value and construct a new rgb-color from the hsl-values of the old color with the l (luminace) part replaced by the new value.

    http://www.bobpowell.net/rgbhsb.htm

    http://en.wikipedia.org/wiki/HSL_and_HSV

    Or, if you use SystemColors, there are some "dark" and "darkdark" predifined Colors in the SystemColors class.

    Regards,

      Thorsten

  • Tuesday, August 21, 2012 4:59 AM
     
     

    Hi,

    Thanks for replying.

    What I meant was dimming the the BackColor of the Form and of all child-controls (sorry if it was unclear!)

    Is there anyway where I can do so in VB?

  • Tuesday, August 21, 2012 5:51 AM
     
     

    Is there anyway where I can do so in VB?

    Follow the procedure outlined in Thorsten's reply.
  • Tuesday, August 21, 2012 1:03 PM
     
     
    ok. Thanks!