📄 peano.frm
字号:
VERSION 5.00
Begin VB.Form peano
BackColor = &H80000005&
Caption = "Peano"
ClientHeight = 10545
ClientLeft = 60
ClientTop = 345
ClientWidth = 12150
LinkTopic = "Form1"
ScaleHeight = 10545
ScaleWidth = 12150
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.CommandButton Command6
Caption = "Save Picture"
Height = 495
Left = 7080
TabIndex = 7
Top = 10200
Width = 975
End
Begin VB.TextBox Text1
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
Height = 375
Left = 3480
TabIndex = 5
Top = 10320
Width = 3375
End
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 495
Left = 240
TabIndex = 1
Top = 10320
Width = 1095
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "Peano1.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 360
Options = 0
ReadOnly = 0 'False
RecordsetType = 0 'Table
RecordSource = "peano"
Top = 120
Visible = 0 'False
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "Run"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 12960
TabIndex = 0
Top = 9960
Width = 1935
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BackColor = &H80000009&
Height = 9735
Left = 120
ScaleHeight = 9675
ScaleWidth = 10035
TabIndex = 4
Top = 120
Width = 10095
End
Begin VB.Label Label3
BackColor = &H80000009&
Caption = "存储路径及文件名:"
Height = 375
Left = 1560
TabIndex = 6
Top = 10440
Width = 1695
End
Begin VB.Label Label2
BackColor = &H80000005&
Caption = "X 1024"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 11160
TabIndex = 3
Top = 10080
Width = 1695
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackColor = &H80000005&
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 8040
TabIndex = 2
Top = 10080
Width = 2895
End
End
Attribute VB_Name = "peano"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const vbDBName As Byte = 1
Private Const vbPicture As Byte = 2
Private bDirty(1 To 2) As Boolean
Function f1(ai As Integer, temp As Integer) As Integer
Dim ii As Integer
ii = ai * 10 + temp
Select Case ii
Case 0: f1 = 1
Case 1: f1 = 0
Case 2: f1 = 0
Case 3: f1 = 2
Case 10: f1 = 0
Case 11: f1 = 1
Case 12: f1 = 1
Case 13: f1 = 3
Case 20: f1 = 3
Case 21: f1 = 2
Case 22: f1 = 2
Case 23: f1 = 0
Case 30: f1 = 2
Case 31: f1 = 3
Case 32: f1 = 3
Case 33: f1 = 1
End Select
End Function
Private Sub Command1_Click()
Dim lB(100) As Long, lC(100) As Long, lN(100) As Long
Dim i As Long, j As Long, lCOUNT As Long
Dim iR As Integer, iG As Integer, iB As Integer
Dim iX As Integer, iY As Integer
Dim lTEMP As Integer, iA As Integer
Dim lTEMP_last1 As Integer, lTEMP_last2 As Integer
lCOUNT = Data1.Recordset.RecordCount
If Data1.Recordset.BOF Then
MsgBox "数据库中没有数据!"
Exit Sub
End If
Data1.Recordset.MoveFirst
For i = 1 To lCOUNT
'lN(0)为从数据库中读出的记录序号
lN(0) = Data1.Recordset.Fields("xh")
iR = Data1.Recordset.Fields("r")
iG = Data1.Recordset.Fields("g")
iB = Data1.Recordset.Fields("b")
iX = 0
iY = 0
lTEMP_last1 = 0
lTEMP_last2 = 0
iA = 0
For j = 1 To 11
lTEMP = lN(j - 1) \ 2 ^ (24 - 2 * j)
If iA = 0 Then
If lTEMP = 0 Or lTEMP = 1 Then
lB(j) = 0
Else
lB(j) = 1
End If
If lTEMP = 0 Or lTEMP = 3 Then
lC(j) = 0
Else
lC(j) = 1
End If
ElseIf iA = 1 Then
If lTEMP = 0 Or lTEMP = 3 Then
lB(j) = 0
Else
lB(j) = 1
End If
If lTEMP = 0 Or lTEMP = 1 Then
lC(j) = 0
Else
lC(j) = 1
End If
ElseIf iA = 2 Then
If lTEMP = 1 Or lTEMP = 2 Then
lB(j) = 0
Else
lB(j) = 1
End If
If lTEMP = 2 Or lTEMP = 3 Then
lC(j) = 0
Else
lC(j) = 1
End If
ElseIf iA = 3 Then
If lTEMP = 2 Or lTEMP = 3 Then
lB(j) = 0
Else
lB(j) = 1
End If
If lTEMP = 1 Or lTEMP = 2 Then
lC(j) = 0
Else
lC(j) = 1
End If
End If
iX = iX + lB(j) * 2 ^ (11 - j)
iY = iY + lC(j) * 2 ^ (11 - j)
lN(j) = lN(j - 1) Mod (2 ^ (24 - 2 * j))
iA = f1(iA, lTEMP)
Next
'绘制坐标点
'peano.PSet (400 + iX * 15, 400 + iY * 15), RGB(iR, iG, iB)
Picture1.PSet (4 + iX * 8, 4 + iY * 8), RGB(iR, iG, iB)
'Picture1.Refresh
Data1.Recordset.MoveNext
If lN(0) Mod 1024 = 0 Then
Label1.Caption = Str(lN(0) / 1024)
Label1.Refresh
End If
Next
End Sub
Private Sub Command2_Click()
Dim lI As Long, lJ As Long
For lI = 257 To 1024
For lJ = 1 To 1024
Data1.Recordset.AddNew
Data1.Recordset.Fields("xh") = (lI - 1) * 1024 + lJ
Data1.Recordset.Fields("r") = Rnd * 255
Data1.Recordset.Fields("g") = Rnd * 255
Data1.Recordset.Fields("b") = Rnd * 255
Data1.Recordset.Update
Next
Label1.Caption = Str(lI)
Label1.Refresh
Next
MsgBox "OK"
End Sub
Private Sub Command3_Click()
If Not Data2.Recordset.RecordCount = 0 Then
Data2.Recordset.Delete
Data2.Refresh
End If
End Sub
Private Sub Command4_Click()
Data2.Recordset.AddNew
Picture2.Picture = LoadPicture("c:\111.bmp")
Data2.Recordset.Update
Data2.Recordset.Bookmark = Data2.Recordset.LastModified
End Sub
Private Sub Command5_Click()
If Not Data2.Recordset.RecordCount = 0 Then
Data2.Recordset.Edit
Picture2.Picture = LoadPicture("c:\111.bmp")
Data2.Recordset.Update
End If
End Sub
Private Sub Command6_Click()
If Text1 = "" Then
MsgBox "请输入路径及文件名"
Exit Sub
End If
SavePicture Picture1.Image, Text1 + ".bmp" '存档
End Sub
Private Sub Data2_Reposition()
Dim lRec As Long
lRec = Data2.Recordset.AbsolutePosition
If lRec >= 0 Then
Data2.Caption = "Record " & CStr(lRec + 1)
End If
End Sub
Private Sub Form_Load()
'Data2.Refresh
End Sub
Private Sub Form_Resize()
Picture1.Left = 0
Picture1.Top = 0
Picture1.Height = Command1.Top - 100
Picture1.Width = peano.Width - 200
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -