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

📄 凸透镜.frm

📁 模拟凸透镜成像
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "点击定点,按a定距"
   ClientHeight    =   5490
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7875
   DrawWidth       =   3
   ForeColor       =   &H000000FF&
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5490
   ScaleWidth      =   7875
   StartUpPosition =   2  '屏幕中心
   Begin VB.Line Line8 
      BorderColor     =   &H80000003&
      X1              =   6000
      X2              =   6000
      Y1              =   0
      Y2              =   6000
   End
   Begin VB.Line Line7 
      BorderColor     =   &H80000003&
      X1              =   5000
      X2              =   5000
      Y1              =   0
      Y2              =   6000
   End
   Begin VB.Line Line6 
      BorderColor     =   &H80000003&
      X1              =   2000
      X2              =   2000
      Y1              =   0
      Y2              =   6000
   End
   Begin VB.Line Line5 
      BorderColor     =   &H80000003&
      X1              =   3000
      X2              =   3000
      Y1              =   0
      Y2              =   6000
   End
   Begin VB.Line Line4 
      BorderColor     =   &H0000FF00&
      X1              =   4000
      X2              =   8000
      Y1              =   840
      Y2              =   6000
   End
   Begin VB.Line Line3 
      BorderColor     =   &H0000FF00&
      X1              =   360
      X2              =   4000
      Y1              =   840
      Y2              =   840
   End
   Begin VB.Line Line2 
      BorderColor     =   &H0000FF00&
      X1              =   240
      X2              =   8000
      Y1              =   840
      Y2              =   5160
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00404040&
      BackStyle       =   1  'Opaque
      BorderColor     =   &H0000FFFF&
      BorderStyle     =   3  'Dot
      Height          =   6000
      Left            =   3900
      Shape           =   2  'Oval
      Top             =   0
      Width           =   200
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00FFFFFF&
      X1              =   0
      X2              =   8000
      Y1              =   3000
      Y2              =   3000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim n As Long, xxx As Integer, yyy As Integer

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 65 Then xxx = yyy
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If xxx <> 0 Then X = xxx
If X >= 4000 Then Exit Sub
a = (Line2.Y2 - Line2.Y1) * (Line4.X2 - Line4.X1)
b = (Line2.X2 - Line2.X1) * (Line4.Y2 - Line4.Y1)
yy = (a * Y - 3000 * b) / (a - b)
xx = (yy - 3000) * (Line2.X2 - Line2.X1) / (Line2.Y2 - Line2.Y1) + 4000
n = n + 1
PSet (X, Y), vbRed
Print n
PSet (xx, yy), vbBlue
Me.ForeColor = vbBlue
Print n
Me.ForeColor = vbRed
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
yyy = X
If xxx <> 0 Then X = xxx
If X >= 4000 Then Exit Sub
Line2.X1 = X: Line2.Y1 = Y: Line2.Y2 = 4000 * (3000 - Y) / (4000 - X) + 3000
Line3.X1 = X: Line3.Y1 = Y: Line3.Y2 = Y
Line4.Y1 = Y: Line4.Y2 = 3 * (3000 - Y) + 3000
End Sub

⌨️ 快捷键说明

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