This small project helps to modify color brightness. This project is not yet commplete because there are little problem which i believe can be correcte by somebody. On my process of developing this work, I ran into a problem. The problem is that the darkest part of the color begins at the Top part of the Panel1 rather than the Bottom part. What i really want is for the Darkest part of the color to start from the Bottom of the Panel1 then to the Top. In a more simple term, i want the opposite direction of the color i.e from Bottom to the Top of the Panel1. Below are the code that I used for the project:
Private g As Graphics Private colorB As Color = Color.Red Public Sub DrawRect() g = Me.Panel1.CreateGraphics Dim rainbow() As Color = {Color.Black, colorB} Dim n As Integer = 0 Dim br As SolidBrush For Each c As Color In rainbow Dim bs As Double For bs = 0 To 1 Step 0.025 br = New SolidBrush(RGBHSL.SetBrightness(c, bs)) g.FillRectangle(br, New Rectangle(CSng(0), CSng(Me.Panel1.Height * bs), CSng(Me.Panel1.Width), _ CSng(Me.Panel1.Height * n))) br.Dispose() Next bs n += 1 Next c g.Dispose() End Sub Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint DrawRect() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)