Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

Alpha Blending Vb.Net forms

Hi is it possible to alphablend the back ground color of a windows form. And if so how do I do it.

Thanks in advance.
0
ConsensusIT
Asked:
ConsensusIT
1 Solution
 
vigridCommented:
Yes. You only need to change the Opacity property of the form, while 1.0 being completely opaque, and 0.0 being completely transparent.

Me.Opacity = 0.5

Above will tell the form to be half-transparent.

HTH?
0
 
ConsensusITAuthor Commented:
What I actually meant was that the forms background color went from say blue to lighter shades of blue as it went down the screen.

Thanks anyway.
0
 
vigridCommented:
You have to create a System.Drawing.Drawing2D.LinearGradientBrush and fill the form by handling its Paint event.

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs)
      Dim brush1 As LinearGradientBrush = New LinearGradientBrush(MyBase.ClientRectangle, Color.Blue, Color.LightBlue, LinearGradientMode.Vertical)
      e.Graphics.FillRectangle(brush1, MyBase.ClientRectangle)
End Sub

HTH
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
armoghanCommented:
0
 
ahmadfuwadCommented:
set the Opacity  property
0
 
vigridCommented:
Thanks for the points. BTW what you needed is not called "Alpha blending", but gradient shading :). Alpha blending is done when you need transparency effects, not simple color changes.

Have fun :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now