Hi,
Ich habe mir den Code zum, Zeichnen einer Parabel von Hier geholt und minimal verändert. JEtzt sieht er so aus:
Leider wird die Parabel immer an der gleichen stelle in der Picturebox gezeichnet.
Woran liegt das ?
MfG
optz
Ich habe mir den Code zum, Zeichnen einer Parabel von Hier geholt und minimal verändert. JEtzt sieht er so aus:
VB.NET-Quellcode
- If RadioButton1.Checked Then
- f = CDbl(TextBox1.Text) * X ^ CDbl(TextBox2.Text) + CDbl(TextBox3.Text) * X + CDbl(Textbox4.Text)
- ElseIf RadioButton2.Checked Then
- f = CDbl(TextBox5.Text) * X ^ CDbl(TextBox6.Text) + CDbl(TextBox7.Text) * X + CDbl(TextBox8.Text)
- ElseIf RadioButton3.Checked Then
- f = CDbl(TextBox9.Text) * X ^ CDbl(TextBox10.Text) + CDbl(TextBox11.Text) * X + CDbl(TextBox12.Text)
- ElseIf RadioButton4.Checked Then
- f = CDbl(TextBox13.Text) * X ^ CDbl(TextBox14.Text) + CDbl(TextBox15.Text) * X + CDbl(TextBox16.Text)
- End If
VB.NET-Quellcode
- Dim Zahl1 As Double = 0
- Dim Zahl2 As Double = 0
- Zahl1 = AutoX()
- Zahl2 = AutoY()
- Dim q As Double = Zahl1
- Do Until q >= Zahl2
- q = q + 1
- Loop
- q = Zahl1
- Dim x1, x2, y1, y2 As Double
- Dim a1, a2, b1, b2, c1, c2 As Double
- Do Until q > Zahl2
- x1 = q
- y1 = f(q)
- q = q + 1
- x2 = q
- y2 = f(q)
- a1 = 280 - x1
- a2 = 280 - x2
- b1 = 280 + x1
- b2 = 280 + x2
- c1 = 280 - y1
- c2 = 280 - y2
- Dim z As Graphics = PictureBox1.CreateGraphics
- z.DrawLine(Pens.Black, CSng(a1), CSng(c1), CSng(a2), CSng(c2))
- z.DrawLine(Pens.Black, CSng(b1), CSng(c1), CSng(b2), CSng(c2))
- Loop
Leider wird die Parabel immer an der gleichen stelle in der Picturebox gezeichnet.
Woran liegt das ?
MfG
optz
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „optz“ ()