Gradient window

D

Dag G

I found this code on the internet. It failed because it seems that line
number 24 is not ready. The parameter lb is not declared. How should I
implement this?

Please help! D.G. Norway

The Code:

01 Private Sub Form1_Resize(ByVal sender As Object, _
02 ByVal e As System.EventArgs) Handles MyBase.Resize
03
04
05 MakeGradient()
06 End Sub
07
08 Private Sub Form1_Activated(ByVal sender As Object, _
09 ByVal e As System.EventArgs) Handles MyBase.Activated
10
11
12 MakeGradient()
13 End Sub
14
15 Private Sub MakeGradient()
16 Dim objBrush As New Drawing2D.LinearGradientBrush _
17 (Me.DisplayRectangle, _
18 Color.Blue, _
19 Color.AliceBlue, _
20 Drawing2D.LinearGradientMode.Vertical)
21
22 Dim objGraphics As Graphics = Me.CreateGraphics()
23
24 objGraphics.FillRectangle(lb, Me.DisplayRectangle)
25
26 objBrush.Dispose()
27 objGraphics.Dispose()
28 End Sub
 
Y

yEaH rIgHt

Change lb in this line:
objGraphics.FillRectangle(lb, Me.DisplayRectangle)

with objBrush:
objGraphics.FillRectangle(objBrush, Me.DisplayRectangle)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top