如何设定色彩亮度

如何设定色彩亮度

本文介绍了如何设定色彩亮度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

推荐答案


这篇关于如何设定色彩亮度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:08