Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

Visual Cobol: Gradient Coloring a Tabpage

$
0
0

I want to color my tabpages using gradient colors. I got this example in Visual Basic:
Public Class Form1
    Dim a As Integer
    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
    End Sub
    Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim formGraphics As Graphics = e.Graphics
        Dim GD As Drawing2D.LinearGradientBrush
        If a = 1 Then
            GD = New Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Width, Height), Color.White, Color.FromArgb(0, 0, 222))
        ElseIf a = 2 Then
            GD = New Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Width, 0), Color.White, Color.FromArgb(0, 222, 0))
        ElseIf a = 3 Then
            GD = New Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(0, Height), Color.White, Color.FromArgb(222, 0, 0))
        Else
            GD = New Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(0, Height), Color.White, Color.FromArgb(0, 0, 0))
            a = 1
        End If
        formGraphics.FillRectangle(GD, ClientRectangle)
        GD.Dispose()
    End Sub
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        a = a + 1
        Refresh()
    End Sub
End Class 

the example colors the whole form; changes color when button1 is pushed. I am not aquainted to VB. Is there an example in Visual Cobol?


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>