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

📄 三角函数与单位圆.frm

📁 三角函数与单位圆的演示,Visual basic
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   Caption         =   "三角函数与单位圆"
   ClientHeight    =   8190
   ClientLeft      =   165
   ClientTop       =   540
   ClientWidth     =   8880
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   8190
   ScaleWidth      =   8880
   StartUpPosition =   3  'Windows Default
   Begin VB.Line Line2 
      BorderColor     =   &H0000FF00&
      BorderWidth     =   2
      X1              =   3090
      X2              =   3930
      Y1              =   2790
      Y2              =   1890
   End
   Begin VB.Line Line1 
      BorderColor     =   &H000000FF&
      X1              =   4860
      X2              =   4860
      Y1              =   510
      Y2              =   5010
   End
   Begin VB.Line Line4 
      BorderColor     =   &H000000FF&
      X1              =   3090
      X2              =   3090
      Y1              =   480
      Y2              =   5370
   End
   Begin VB.Line Line3 
      BorderColor     =   &H000000FF&
      X1              =   1110
      X2              =   8040
      Y1              =   2820
      Y2              =   2820
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00000000&
      BorderColor     =   &H000000FF&
      Height          =   3105
      Left            =   1800
      Shape           =   3  'Circle
      Top             =   1290
      Width           =   2565
   End
   Begin VB.Image Image1 
      Height          =   255
      Left            =   3870
      Picture         =   "三角函数与单位圆.frx":0000
      Stretch         =   -1  'True
      Top             =   1710
      Width           =   255
   End
   Begin VB.Menu cd 
      Caption         =   "cd"
      Visible         =   0   'False
      Begin VB.Menu about 
         Caption         =   "关于本课件"
      End
      Begin VB.Menu readme 
         Caption         =   "使用说明"
      End
      Begin VB.Menu k1 
         Caption         =   "-"
      End
      Begin VB.Menu showSin 
         Caption         =   "显示正弦图线"
      End
      Begin VB.Menu showTan 
         Caption         =   "显示正切图线"
      End
      Begin VB.Menu k2 
         Caption         =   "-"
      End
      Begin VB.Menu exit 
         Caption         =   "退出"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const PI = 3.14159265
Dim a As Single, b As Single, r As Single, r1 As Single
Dim x0 As Single, y0 As Single
Dim xx As Single, yy As Single

Private Sub draw()
   Dim i As Single, s As Single
   Dim jX As Single, jY As Single, sX As Single, sY As Single
   Dim tX As Single, tY As Single
   Cls
   s = 1000
   jX = x0 + r1
   jY = y0
   sX = 2 * x0
   sY = y0
   tX = 2 * x0
   tY = y0
   Form1.DrawStyle = 0
   For i = 0 To a Step 0.02
      Form1.DrawWidth = 1
      Form1.Line (jX, jY)-(x0 + r1 * Cos(i), y0 - r1 * Sin(i)), vbGreen  '画角度
      jX = x0 + r1 * Cos(i)
      jY = y0 - r1 * Sin(i)
      If showSin.Checked Then
         Form1.DrawWidth = 2
         Form1.Line (sX, sY)-(2 * x0 + i * s, y0 - r * Sin(i)), vbWhite   '画正弦曲线
         sX = 2 * x0 + i * s
         sY = y0 - r * Sin(i)
      End If
      If showTan.Checked Then
         Form1.DrawWidth = 2
         If Sgn(tY) = Sgn(y0 - r * Tan(i)) Then                      '防止正无穷到负无穷
            Line (tX, tY)-(2 * x0 + i * s, y0 - r * Tan(i)), vbYellow   '画正切曲线
         End If
         tX = 2 * x0 + i * s
         tY = y0 - r * Tan(i)
      End If
   Next
   If showSin.Checked Then Form1.Line (xx, y0)-(xx, yy), vbWhite   '画正弦线
   If showTan.Checked Then
      Form1.Line (x0 + r, y0)-(x0 + r, y0 - r * Tan(a)), vbYellow   '画正切线
      Form1.DrawStyle = 2
      Form1.DrawWidth = 1
      If xx >= x0 Then
         Form1.Line (xx, yy)-(x0 + r, y0 - r * Tan(a)), vbYellow
      Else
         Form1.Line (x0, y0)-(x0 + r, y0 - r * Tan(a)), vbYellow
      End If
   End If
End Sub

Private Sub about_Click()
   Dim say As String
   say = say + "“三角函数与单位圆”课件" + Chr(13) + Chr(13)
   say = say + "制作:毕广吉" + Chr(13)
   say = say + "天津师范大学物理与电子信息学院" + Chr(13)
   say = say + "2001年7月" + Chr(13)
   say = MsgBox(say, vbOKOnly, "关于“三角函数与单位圆”课件")
End Sub

Private Sub exit_Click()
   End
End Sub

Private Sub Form_Load()
   Form1.Width = Screen.Width
   Form1.Height = Screen.Height
   Form1.Left = 0
   Form1.Top = 0
   Form1.BackColor = 0
   x0 = Form1.Width / 5
   y0 = Form1.Height * 0.4
   r = x0 - 200
   r1 = r / 5
   Shape1.Left = x0 - r
   Shape1.Top = y0 - r
   Shape1.Width = 2 * r
   Shape1.Height = 2 * r
   Line3.X1 = 0
   Line3.Y1 = y0
   Line3.X2 = Form1.Width
   Line3.Y2 = y0
   Line4.X1 = x0
   Line4.Y1 = y0 - r - 1000
   Line4.X2 = x0
   Line4.Y2 = y0 + r + 1000
   Line1.X1 = x0 * 2
   Line1.Y1 = y0 - r - 1000
   Line1.X2 = x0 * 2
   Line1.Y2 = y0 + r + 1000
   Line2.X2 = x0
   Line2.Y2 = y0
   Line2.X1 = x0 + r
   Line2.Y1 = y0
   Image1.Left = x0 + r - Image1.Width / 2
   Image1.Top = y0 - Image1.Height / 2
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
   If Button = 2 Then PopupMenu cd
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   If Button > 0 Then
      b = Image1.Left + X - x0 + IIf(Image1.Left + X - x0 = 0, 1, 0)   '防止分母为0
      a = Abs(Atn((Image1.Top + Y - y0) / b))           '计算圆心角
      a = IIf(Image1.Left + X - x0 < 0 And Image1.Top + Y - y0 < 0, PI - a, a) '修正第二象限
      a = IIf(Image1.Left + X - x0 < 0 And Image1.Top + Y - y0 >= 0, a + PI, a) '修正第三象限
      a = IIf(Image1.Left + X - x0 >= 0 And Image1.Top + Y - y0 >= 0, 2 * PI - a, a) '修正第四象限
      xx = x0 + r * Cos(a)
      yy = y0 - r * Sin(a)
      Image1.Left = xx - Image1.Width / 2      '移动小球
      Image1.Top = yy - Image1.Height / 2
      Line2.X1 = xx                             '移动半径
      Line2.Y1 = yy
      '画图
      Call draw
   End If
End Sub

Private Sub readme_Click()
   Dim say As String
   say = say + "1.单位圆上的拖动点可以顺时针、逆时针任意拖动。" + Chr(13)
   say = say + "  图形即时绘出。" + Chr(13)
   say = say + "2.可以在快捷菜单中自由选择显示或不显示正弦曲" + Chr(13)
   say = say + "  线,也可以自由选择显示或不显示正切曲线。" + Chr(13)
   say = MsgBox(say, vbOKOnly, "“三角函数与单位圆”课件使用说明:")
End Sub

Private Sub showSin_Click()
   showSin.Checked = Not showSin.Checked
   Call draw
End Sub

Private Sub showTan_Click()
   showTan.Checked = Not showTan.Checked
   Call draw
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -