Public Class Dim As Single Me Dim As Single Me Dim As: Form1 Graphics
This code defines variables to store the width, height, and center point of a form. It creates a graphics object and draws the x and y axes at the center point. It then uses a for loop to calculate x and y values for a logarithmic function, shifts the points to be relative to the center, and draws the curve on the form between each pair of points.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
32 views1 page
Public Class Dim As Single Me Dim As Single Me Dim As: Form1 Graphics
This code defines variables to store the width, height, and center point of a form. It creates a graphics object and draws the x and y axes at the center point. It then uses a for loop to calculate x and y values for a logarithmic function, shifts the points to be relative to the center, and draws the curve on the form between each pair of points.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Public Class Form1
Dim x0 As Single = Me.Width / 2
Dim y0 As Single = Me.Height / 2 Dim l As Graphics
Private Sub Btngraficar_Click(sender As Object, e As EventArgs) Handles Btngraficar.Click
graficar() End Sub Private Sub graficar() l = Me.CreateGraphics() l.DrawLine(Pens.DarkBlue, 0, y0, Me.Width, y0) l.DrawLine(Pens.DarkBlue, x0, 0, x0, Me.Height) Dim xi, yi, xf, yf As Single Dim i As Single For i = 0.01 To Me.Width / 20 Step 0.05 xi = 20 * i yi = 20 * Math.Log(xi) xf = 20 * (i + 0.1) yf = 20 * Math.Log(xf) xi += x0 yi = y0 - yi xf += x0 yf = y0 - yf l.DrawLine(Pens.Red, xi, yi, xf, yf) Next End Sub End Class