Click here to Skip to main content
15,879,326 members
Articles / Multimedia / GDI+

A Reflective and Translucent Glass Panel

Rate me:
Please Sign up or sign in to vote.
4.50/5 (13 votes)
1 Oct 2008CPOL 79.6K   6.3K   50  
Component derived from Panel that acts like a window (glass)
Imports System.Drawing

Module Colors

    Public Function Darken(ByVal Color As Color) As Color
        Return Drawing.Color.FromArgb(Color.A, DeductMinZero(Color.R, 20), DeductMinZero(Color.G, 20), DeductMinZero(Color.B, 20))
    End Function

    Public Function Lighten(ByVal Color As Color) As Color
        Return Drawing.Color.FromArgb(Color.A, AddMax255(Color.R, 20), AddMax255(Color.G, 20), AddMax255(Color.B, 20))
    End Function

    Public Function DeductMinZero(ByVal Value As Integer, ByVal Deduction As Integer) As Integer
        If Value - Deduction < 0 Then
            Return 0
        Else
            Return Value - Deduction
        End If
    End Function

    Public Function AddMax255(ByVal Value As Integer, ByVal Addition As Integer) As Integer
        If Value + Addition > 255 Then
            Return 255
        Else
            Return Value + Addition
        End If
    End Function


End Module

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions