EDN Admin
Well-known member
Using visual basic express 2010 how do i plot points instead of using <span style="font-size:small
<span style="font-size:small e.Graphics.DrawLine for example.
<span style="font-size:small <span style="font-size:small Imports System.Math<br/>
Public Class Form1<br/>
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint<br/>
Dim blueBrush As New Drawing.SolidBrush(Color.Blue)<br/>
e.Graphics.FillRectangle(blueBrush, 0, 0, 500, 500)<br/>
Dim greenPen As New Drawing.Pen(Color.Green, 1)<br/>
Dim xLeft, yLeft, cAngle, xOffset0, yOffset0, xOffset1, yOffset1 As Integer<br/>
Dim cSine0, cCosin0, cSine1, cCosin1 As Single<br/>
xLeft = 0<br/>
yLeft = 0<br/>
For cAngle = 1 To 360 Step 2<br/>
cSine0 = Sin(cAngle - 1)<br/>
cCosin0 = Cos(cAngle - 1)<br/>
cSine1 = Sin(cAngle)<br/>
cCosin1 = Cos(cAngle)<br/>
xOffset0 = 250 * cCosin0<br/>
yOffset0 = 250 * cSine0<br/>
xOffset1 = 250 * cCosin1<br/>
yOffset1 = 250 * cSine1<br/>
e.Graphics.DrawLine(greenPen, 250 + yOffset0, 250 + xOffset0, 250 + yOffset1, 250 + xOffset1)<br/>
Next<br/>
End Sub<br/>
End Class
View the full article
<span style="font-size:small e.Graphics.DrawLine for example.
<span style="font-size:small <span style="font-size:small Imports System.Math<br/>
Public Class Form1<br/>
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint<br/>
Dim blueBrush As New Drawing.SolidBrush(Color.Blue)<br/>
e.Graphics.FillRectangle(blueBrush, 0, 0, 500, 500)<br/>
Dim greenPen As New Drawing.Pen(Color.Green, 1)<br/>
Dim xLeft, yLeft, cAngle, xOffset0, yOffset0, xOffset1, yOffset1 As Integer<br/>
Dim cSine0, cCosin0, cSine1, cCosin1 As Single<br/>
xLeft = 0<br/>
yLeft = 0<br/>
For cAngle = 1 To 360 Step 2<br/>
cSine0 = Sin(cAngle - 1)<br/>
cCosin0 = Cos(cAngle - 1)<br/>
cSine1 = Sin(cAngle)<br/>
cCosin1 = Cos(cAngle)<br/>
xOffset0 = 250 * cCosin0<br/>
yOffset0 = 250 * cSine0<br/>
xOffset1 = 250 * cCosin1<br/>
yOffset1 = 250 * cSine1<br/>
e.Graphics.DrawLine(greenPen, 250 + yOffset0, 250 + xOffset0, 250 + yOffset1, 250 + xOffset1)<br/>
Next<br/>
End Sub<br/>
End Class
View the full article