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
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
- Edited by Thorsten GuderaMicrosoft Community Contributor Monday, August 20, 2012 10:51 PM
- Proposed As Answer by Mark Liu-lxfModerator Tuesday, August 21, 2012 6:56 AM
- Marked As Answer by Mark Liu-lxfModerator Tuesday, August 28, 2012 7:22 AM
-
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
Follow the procedure outlined in Thorsten's reply.Is there anyway where I can do so in VB?
-
Tuesday, August 21, 2012 1:03 PMok. Thanks!

