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

📄 main1.frm

📁 一个图象处理的小软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4260
   ClientLeft      =   165
   ClientTop       =   855
   ClientWidth     =   6645
   LinkTopic       =   "Form1"
   ScaleHeight     =   4260
   ScaleWidth      =   6645
   StartUpPosition =   3  '窗口缺省
   Begin VB.HScrollBar prgresult 
      Height          =   255
      Left            =   3240
      TabIndex        =   2
      Top             =   3960
      Width           =   3375
   End
   Begin VB.PictureBox pic1 
      Height          =   3735
      Left            =   120
      ScaleHeight     =   3675
      ScaleWidth      =   2955
      TabIndex        =   1
      Top             =   120
      Width           =   3015
      Begin VB.Image img1 
         Height          =   3735
         Left            =   0
         Top             =   0
         Width           =   3015
      End
   End
   Begin VB.PictureBox pic2 
      Height          =   3735
      Left            =   3240
      ScaleHeight     =   3675
      ScaleWidth      =   3195
      TabIndex        =   0
      Top             =   120
      Width           =   3255
   End
   Begin VB.Menu file 
      Caption         =   "文件(&F)"
      Begin VB.Menu open 
         Caption         =   "打开(&O)"
      End
      Begin VB.Menu exit 
         Caption         =   "退出(&E)"
      End
   End
   Begin VB.Menu edit 
      Caption         =   "编辑(&E)"
      Begin VB.Menu draw 
         Caption         =   "鼠标绘图(&D)"
         Enabled         =   0   'False
      End
      Begin VB.Menu mov 
         Caption         =   "移动图像(&M)"
         Enabled         =   0   'False
      End
      Begin VB.Menu tran 
         Caption         =   "旋转图像(&T)"
         Enabled         =   0   'False
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub draw_Click()
frmdraw.Show vbModal
End Sub

Private Sub exit_Click()
End
End Sub

Private Sub Image1_Click()

End Sub

Private Sub img2_Click()

End Sub

Private Sub mov_Click()
X2 = 300
Y2 = 160
img1.move img1.Left + X2, img1.Top + Y2
End Sub

Private Sub open_Click()
draw.Visible = True
draw.Enabled = True
mov.Visible = True
mov.Enabled = True
tran.Visible = True
tran.Enabled = True
img1.Stretch = True
frmdraw.Cmdlg2.DialogTitle = ""
frmdraw.Cmdlg2.Filter = "(*.bmp)|*.bmp"
frmdraw.Cmdlg2.ShowOpen
img1.Picture = LoadPicture(frmdraw.Cmdlg2.FileName)
End Sub





Private Sub prgresult_Change()
prgresult.Min = 0
prgresult.Max = pic1.Width
prgresult.Visible = True
prgresult.Value = 0
Screen.MousePointer = 11
For i = 0 To img1.Width - 1
For j = 0 To img1.Height - 1
c = pic1.Point(i, j)
r1 = (c And &HFF)
g1 = (c And 65280) \ 256
b1 = (c And &HFF0000) \ 65536
cc = pic1.Point(j + 1, i)
r2 = (cc And &HFF)
g2 = (cc And 65280)
b2 = (cc And &HFF0000) \ 65536
cd = pic1.Point(j, i + 1)
g3 = (cc And 65280) \ 256
b3 = (cd And &HFF0000) \ 65536
rr1 = (r1 - r2) ^ 2: rr2 = (r1 - r3) ^ 2: rr = 2 * (rr1 + rr2) ^ 0.5
gg1 = (g1 - g2) ^ 2: gg2 = (g1 - g3) ^ 2: gg = 2 * (gg1 + gg2) ^ 0.5
bb1 = (b1 - b2) ^ 2: bb2 = (b1 - b3) ^ 2: bb = 2 * (bb1 + bb2) ^ 0.5
If rr < 0 Then rr = 0
If rr > 255 Then rr = 255
If gg < 0 Then gg = 0
If gg > 255 Then gg = 255
If bb < 0 Then bb = 0
If bb > 255 Then bb = 255
pic2.PSet (j, i), RGB(rr, gg, bb)
Next j
n = n + 1
prgresult.Value = n
Next i
prgresult.Value = n
Screen.MousePointer = 0

End Sub

Private Sub tran_Click()
pic2.Cls
blocksize = 3
n = 0

End Sub

⌨️ 快捷键说明

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