Hello I'm writing a kind of a paint program that works with lines.
Now when I try in the auto color system to implant a kind of "gradient", so the
first line will get the color 255;0;0 and the next line will get 255;1;0 and so
on... I have been stuck at a problem, if I set it to try and go from 255;0;0 to
255;255;255, it goes to 255;255;0 and no further and it won't go back if it
reached that.
Here's my code for it.
EDIT: Just so you know the
picturebox2
contains the color for the
pen, and it's not one line that should be gradient. It's many different lines that
should be gradient with each other.
EDIT2 (for more clearance): if we say we have color1 and color2, and color1 =
255;0;0 and color2 = 255;0;255 then for every line i draw the color of the line be
more like color2 so that the first line has the color 255;0;0 the next line is
255;0;1 the third is 255;0;2 and so on
EDIT3: this is some updated code now.. this works but it's quite buggy, sometimes i goes to a completely random color and it should just go up or down :\
Edit4: here a little test with the code below
http://img227.imageshack.us/img227/337/testobject.png
the problem is that it's quite buggy :(
If cb5.Checked = True Then
Try
Dim c1 As Color = colo1.BackColor
Dim c2 As Color = colo2.BackColor
Dim pc1 As Color = PictureBox2.BackColor
If counter = 0 Then
If pc1 = c2 Then
counter = 1
Else
If pc1.R = c2.R Then
If pc1.G = c2.G Then
If pc1.B = c2.B Then
counter = 1
Else
PictureBox2.BackColor = Color.FromArgb(pc1.R, pc1.G, pc1.B + 1)
End If
Else
PictureBox2.BackColor = Color.FromArgb(pc1.R, pc1.G + 1, pc1.B)
End If
Else
PictureBox2.BackColor = Color.FromArgb(pc1.R + 1, pc1.G, pc1.B)
End If
End If
ElseIf counter = 1 Then
If pc1 = c1 Then
counter = 0
Else
If pc1.B = c1.B Then
If pc1.G = c1.G Then
If pc1.R = c1.R Then
counter = 0
Else
PictureBox2.BackColor = Color.FromArgb(pc1.R - 1, pc1.G, pc1.B)
End If
Else
PictureBox2.BackColor = Color.FromArgb(pc1.R, pc1.G - 1, pc1.B)
End If
Else
PictureBox2.BackColor = Color.FromArgb(pc1.R, pc1.G, pc1.B - 1)
End If
End If
End If
Catch
End Try
p = New Pen(PictureBox2.BackColor)
PictureBox1.Image = bit
End If
I hope I have described it well and I can get some help from you. :)