You must Sign In to post a response.
  • Category: Visual Studio

    With the help of VB.NET

    Anyone tell me how we can provide the shaded color in VB.Net ?
  • #723643


    try like below code snippet to change form control background as gradient

    Imports System.Drawing.Drawing2D
    Imports System.Configuration

    Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or _
    ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
    End Sub
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    Dim formGraphics As Graphics = e.Graphics
    Dim gradientBrush As New LinearGradientBrush(New Point(0, Height), New Point(0, 0), Color.LightBlue, Color.Gray)
    formGraphics.FillRectangle(gradientBrush, ClientRectangle)
    End Sub
    End Class

    And also newly added control like group box set back ground as web->gradient

    Your Hard work never fails

  • #723660

    To change the color it is always good to apply the exact opposite color of the one you are using by default.

    Private Sub btnChangeColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChangeColor.Click

    btnChangeColor.ForeColor = DirectCast(IIf(btnChangeColor.ForeColor.ToArgb = Color.PeachPuff.ToArgb, Color.Black, Color.PeachPuff), Color)

    End Sub

    Asheej T K

  • #723694
    I could use the following code for shaded color in VB.Net
    MyForm1.BackGroundColor = Color.White
    MyForm1.BackgroundColor = Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))

  • #723695
    hello vishakha dabasia i supos help you ..

    pleaz ....enter its link

    and view the your problem ....thankyou

  • #723995
    [Response removed by Admin. Read forum policies.]

  • #724052
    [Response removed by Admin. Read forum policies.]

  • #724640
    hey vish you can use following link for your solution :

    i hope your problem is solved

    - Regards
    Nayan Vyas

  • #724893
    [Response removed by Admin. Read forum policies.]

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.