Solved

Fast way to change alpha of LinearGradientBrush

Posted on 2009-04-09
2
435 Views
Last Modified: 2013-12-17

Hey, is there a fast (i.e., no for loops, and doesn't cause delay if used in a paint function) way to change the alpha of a LinearGradientBrush, i.e., filling in this function:

Thanks.


Friend Function MakeTranslucentGradientBrushForeColor(ByVal brsh As LinearGradientBrush) As LinearGradientBrush
 

        If m_Alpha = 255 Then

            Return brsh

        Else

            Dim rtn As LinearGradientBrush

...   magic code to change alpha or make new brush with changed alpha
 

            Return brsh
 

        End If
 

    End Function

Open in new window

0
Comment
Question by:riceman0
2 Comments
 
LVL 15

Accepted Solution

by:
oobayly earned 500 total points
ID: 24115089
Can you explain which colours you are having to change, the LinearColors array, or the InterpolationColors.Colors array?
If it's the former, you're only changing 2 colors.

Just running some basic code to set the alpha value for an array of 141 colours (The number of named colours in the Color struct), and timing it resulted in a elapsed time of 0ms. And that was running in debug mode.

Any chance you can post what code you're using to generate the LinearGradientBrush, and what properties in the brush you wish to change?
0
 

Author Comment

by:riceman0
ID: 24118943
It was a malformed question, what I was trying was working but something else was wrong. Points awarded for effort, thanks.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now