I can't seem to figure out how to draw a gradient to a bitmap I created in code. I have the background fading with a crazy bouncing sort of gradient with this code (paste it into a project if U wanna see it)
I can't seem to create a graphics area from the bitmap itself so I don't know any other way to draw graphics data onto the bitmap. Anyone know how to do it?VB Code:
Dim m_intAntiBlueC1 As Integer = 255 Dim m_intAntiBlueC2 As Integer = 0 Dim m_blnC1GoUp As Boolean Dim graphics As Graphics graphics = Me.CreateGraphics() Dim c1 As Color = Color.FromArgb(m_intAntiBlueC1, m_intAntiBlueC1, 200) Dim c2 As Color = Color.FromArgb(m_intAntiBlueC2, m_intAntiBlueC2, 200) Dim brush As New Drawing2D.LinearGradientBrush(Me.DisplayRectangle, c1, c2, Drawing2D.LinearGradientMode.ForwardDiagonal) graphics.FillRectangle(brush, Me.DisplayRectangle) [COLOR=Red] Dim TheBit As New Bitmap(295, 80) Dim graphics2 As Graphics[/COLOR] If m_intAntiBlueC1 = 255 Then m_blnC1GoUp = False ElseIf m_intAntiBlueC1 = 0 Then m_blnC1GoUp = True End If If m_blnC1GoUp Then m_intAntiBlueC1 += 1 m_intAntiBlueC2 -= 1 Else m_intAntiBlueC1 -= 1 m_intAntiBlueC2 += 1 End If




)
Reply With Quote