none
Visual Basic Form Design

    Question

  • Okay guys this is my first thread as well as my first dive into programming. So my question is, I want to have this design on my form that would fade from blue to black, and I have no idea how to do this. So picture a form thats blue and when you look towards the bottom of the form it starts to fade to black. Thanks guys.
    Sunday, February 19, 2012 5:20 AM

Answers

  • Hi,

    I think the best answer to your question would be the link below :

    http://www.vbforums.com/showthread.php?t=619840

    Just download the project from link and open it in visual studio 2010 to upgrade it say upgrade --> download the FormGradient.vb file from the website and use it to replace it in the upgraded project directory file with same name.... reopen the project... Run it after setting different colours... for gradients you require...

    Please revert with more feedback if required...

    Please mark it as answer if it helps you or unpropose it as answer if it does not help you.


    Thanks

    Rehan Bharucha - The Tech Robot

    MCTS, MCITP, MCPD, MCT, MCC


    Sunday, February 19, 2012 5:43 AM
  • ... extended (resize support):

    Public Class Form1
        Private Sub Form1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
            Using l As New System.Drawing.Drawing2D.LinearGradientBrush(New Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height),
                                                                        Color.Blue, Color.Black,
                                                                        System.Drawing.Drawing2D.LinearGradientMode.Vertical)
    
                e.Graphics.FillRectangle(l, New Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height))
            End Using
        End Sub
    
        Private Sub Form1_Layout(sender As System.Object, e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout
            Me.Invalidate()
        End Sub
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            Me.DoubleBuffered = True
        End Sub
    End Class

    • Proposed as answer by jwavila Sunday, February 19, 2012 6:47 AM
    • Marked as answer by Shanks ZenModerator Thursday, March 01, 2012 8:27 AM
    Sunday, February 19, 2012 5:36 AM

All replies

  • Hi,

    draw it:

    Public Class Form1
        Private Sub Form1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
            Using l As New System.Drawing.Drawing2D.LinearGradientBrush(New Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height),
                                                                        Color.Blue, Color.Black,
                                                                        System.Drawing.Drawing2D.LinearGradientMode.Vertical)
    
                e.Graphics.FillRectangle(l, New Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height))
            End Using
        End Sub
    End Class

    Regards,

      Thorsten

    Sunday, February 19, 2012 5:34 AM
  • ... extended (resize support):

    Public Class Form1
        Private Sub Form1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
            Using l As New System.Drawing.Drawing2D.LinearGradientBrush(New Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height),
                                                                        Color.Blue, Color.Black,
                                                                        System.Drawing.Drawing2D.LinearGradientMode.Vertical)
    
                e.Graphics.FillRectangle(l, New Rectangle(0, 0, Me.ClientSize.Width, Me.ClientSize.Height))
            End Using
        End Sub
    
        Private Sub Form1_Layout(sender As System.Object, e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout
            Me.Invalidate()
        End Sub
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            Me.DoubleBuffered = True
        End Sub
    End Class

    • Proposed as answer by jwavila Sunday, February 19, 2012 6:47 AM
    • Marked as answer by Shanks ZenModerator Thursday, March 01, 2012 8:27 AM
    Sunday, February 19, 2012 5:36 AM
  • Hi,

    I think the best answer to your question would be the link below :

    http://www.vbforums.com/showthread.php?t=619840

    Just download the project from link and open it in visual studio 2010 to upgrade it say upgrade --> download the FormGradient.vb file from the website and use it to replace it in the upgraded project directory file with same name.... reopen the project... Run it after setting different colours... for gradients you require...

    Please revert with more feedback if required...

    Please mark it as answer if it helps you or unpropose it as answer if it does not help you.


    Thanks

    Rehan Bharucha - The Tech Robot

    MCTS, MCITP, MCPD, MCT, MCC


    Sunday, February 19, 2012 5:43 AM