⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 曲线绘制程序曲线绘制程序曲线绘制程序曲线绘制程序曲线绘制程序曲线绘制程序曲线绘制程序曲线绘制程序曲线绘制程序曲线绘制程序
💻 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 + -