?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5490
ClientLeft = 60
ClientTop = 450
ClientWidth = 10095
LinkTopic = "Form1"
ScaleHeight = 5490
ScaleWidth = 10095
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 1095
Left = 6600
TabIndex = 2
Text = "1"
Top = 3240
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 735
Left = 6120
TabIndex = 1
Top = 1080
Width = 3015
End
Begin VB.PictureBox Picture1
Height = 3375
Left = 600
ScaleHeight = 3315
ScaleWidth = 4515
TabIndex = 0
Top = 480
Width = 4575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const Pi = 3.1415926535 '定義圓周率
Dim a, wor
'定義用于在Picture1上的一個位置打印字符函數
Private Function PrintWord(X, Y, Word As String)
With Picture1
.CurrentX = X
.CurrentY = Y
.ForeColor = RGB(0, 0, 255)
End With
Picture1.Print Word
End Function
'定義畫點函數
Private Function DrawDot(Px, Py, Color)
Picture1.PSet (Px, Py), Color
End Function
Sub XY() '建立直角坐標系
Picture1.DrawWidth = 1 '設置線條寬度
Picture1.Cls
'設定用戶坐標系,坐標原點在Picture1中心
Picture1.Scale (-2, 45)-(20, 29)
Picture1.Line (0, 0)-(20, 0), RGB(0, 0, 255)
Picture1.Line -(19.5, 0.5), RGB(0, 0, 255)
Picture1.Line (20, 0)-(19.5, -0.5), RGB(0, 0, 255)
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.Print "X"
'畫 X 軸
Picture1.Line (0, 30)-(0, 45), RGB(0, 0, 255)
Picture1.Line -(0.5, 9.5), RGB(0, 0, 255)
Picture1.Line (0, 10)-(-0.5, 9.5), RGB(0, 0, 255)
Picture1.Print "Y"
'畫 Y 軸
For Lin = -9 To 9
Picture1.Line (Lin, 0)-(Lin, 0.25)
wor = PrintWord(Lin - 0.5, -0.5, Str(Lin))
Picture1.Line (0, Lin)-(-0.25, Lin)
If Lin <> 0 Then
wor = PrintWord(-0.9, Lin, Str(Lin))
End If
Next Lin
Picture1.DrawWidth = 2
End Sub
Private Sub Command1_Click()
Dot = DrawDot(Text1.Text, Text1.Text, RGB(255, 0, 255))
'Picture1.Line (0, Text1.Text)-(Text1.Text, 0)
wor = PrintWord(6, 2, "雙曲線 y=1/x")
End Sub
Private Sub Form_Load()
Me.Caption = "數學函數作圖?quot;"
Me.Show
Me.AutoRedraw = True
Picture1.BackColor = vbWhite
'Command1.Caption = "正弦曲線"
'Command2.Caption = "余弦曲線"
'Command3.Caption = "二次曲線"
'Command4.Caption = "雙曲線"
'Command5.Caption = "清空"
XY
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -