-1

I created a function of drawing the pixel But I can not show it i want to use my methode to draw point As in the following code

Imports System.Math
Public Class Form1

Private Sub myc(ByVal x1 As Integer, ByVal y1 As Integer, ByVal r As Integer, ByVal r2 As Integer, ByVal c As Double)
    Dim y, nx, ny As Integer
    Dim th As Double
    For th = 0 To 360 Step 1
        nx = x1 + r * Sin(th * 22 / 7 / 180)
        ny = y1 + r2 * Cos(th * 22 / 7 / 180)
    Next
End Sub

End Class

1 Answers1

0
Private Sub cir(ByVal x1 As Integer, ByVal y1 As Integer, ByVal r1 As Integer, ByVal r2 As Integer, ByVal c As Color)

        Dim pic As Bitmap = New System.Drawing.Bitmap(1000, 1000)
        Dim th As Double
        Dim nx, ny As Integer

        For th = 0 To 360 Step 0.5

            nx = x1 + r1 * Cos(th * 22 / 7 / 180)
            ny = x1 + r2 * Sin(th * 22 / 7 / 180)
            pic.SetPixel(nx, ny, c)
            PictureBox1.Image = pic


        Next th

    End Sub



    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        cir(100, 100, 50, 50, Color.Blue)


    End Sub