积极答复者
VB.NET中怎么绘制函数图像?

问题
答案
-
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim x0 As Single, y0 As Single, x As Single, y As Single, r As Single, width As Single, height As Single
r = 0.01
For x0 = 10 To 20
y0 = 6 * x0 - 3
width = r * 2
height = r * 2x = x0 - width / 2
y = y0 - height / 2e.Graphics.FillEllipse(Brushes.Red, x, y, width, height)
Next
End Sub
http://feiyun0112.cnblogs.com/- 已标记为答案 liunain021 2009年3月4日 13:22
全部回复
-
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim x0 As Single, y0 As Single, x As Single, y As Single, r As Single, width As Single, height As Single
r = 0.01
For x0 = 10 To 20
y0 = 6 * x0 - 3
width = r * 2
height = r * 2x = x0 - width / 2
y = y0 - height / 2e.Graphics.FillEllipse(Brushes.Red, x, y, width, height)
Next
End Sub
http://feiyun0112.cnblogs.com/- 已标记为答案 liunain021 2009年3月4日 13:22
-
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias '消除锯齿
e.Graphics.TranslateTransform(0, Me.ClientRectangle.Height) '平移变换,将Y坐标下移Form的高度
e.Graphics.ScaleTransform(1, -1) '缩放变换,Y坐标缩放比例为-1以完成Y的反向
e.Graphics.TranslateTransform(0, 60) '把坐标原点放在(0,60)
Dim pen1 As Pen
pen1 = New Pen(Color.Black, 2)
Dim i As Integer
Dim x1, x2, y1, y2 As Integer
x1 = 10
y1 = 57
For i = 1 To 10
x2 = 10 + i * 1
y2 = 6 * x2 - 3
e.Graphics.DrawLine(pen1, x1, y1, x2, y2)
x1 = x2
y1 = y2
Next
End Sub
这样可以了
visual studio 2008