📄 ex1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Matrix<LIB> for Visual Basic Example 1"
ClientHeight = 7020
ClientLeft = 945
ClientTop = 1005
ClientWidth = 5100
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 7020
ScaleWidth = 5100
Begin VB.TextBox txtEye
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 240
MultiLine = -1 'True
TabIndex = 5
Top = 4200
Width = 4575
End
Begin VB.TextBox txtRand
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 240
MultiLine = -1 'True
TabIndex = 2
Top = 480
Width = 4575
End
Begin VB.TextBox txtInv
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 240
MultiLine = -1 'True
TabIndex = 1
Top = 2280
Width = 4575
End
Begin VB.CommandButton Command1
Caption = "New Computation"
Height = 495
Left = 1320
TabIndex = 0
Top = 5880
Width = 2295
End
Begin VB.Label Label2
Caption = "="
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 177
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2400
TabIndex = 4
Top = 3480
Width = 255
End
Begin VB.Label Label1
Caption = "X"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 177
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2400
TabIndex = 3
Top = 1560
Width = 255
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
' Get a normal random 3x3 matrix
a = randn(3)
' Find its inverse matrix
b = inv(a)
' Multiply (will be identity)
c = mtimes(a, b)
' Show them all
ShowMat a, txtRand
ShowMat b, txtInv
ShowMat c, txtEye
End Sub
Private Sub ShowMat(mat, where As TextBox)
Dim m As Long, n As Long
Dim t As String, d As String
Dim matij As Double
m = mat.rows
n = mat.cols
For i = 1 To m
For j = 1 To n
matij = mat.r2(i, j)
d = Format$(matij, "####0.0##")
d = Space$(10 - Len(d)) & d
t = t & " " & d
Next
t = t & Chr$(13) & Chr$(10)
Next
where.Text = t
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -