选题介绍及意义,程序模块及功能,程序流程图,程序源码及注释,程序的后续完善及存在问题,设计程序的心得体会 一.选题说明及意义
用VB实现备忘录的基本功能,包括记事本,屏幕抓图,数字时钟和日历等功能,利用VB中的诸多控件,例如
PictureBox,Label,CommendButton,Timer,CommendDialog,RichTextBox等,完成VB程序的诸多功能的实现,创建功能较为完善的记事本,并具有一定辅助功能,对于利用此软件的人能够具有一定的便利。 二.程序模块及功能实现流程图
三.部分程序代码 1.屏幕截图部分
Private Declare Function GetDC Lib \(ByVal hwnd As Long) As Long
Private Declare Function StretchBlt Lib \(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long,
1
ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Sub Command1_Click() Dim wScreen As Long Dim hScreen As Long Dim w As Long Dim h As Long Picture1.Cls
wScreen = Screen.Width \\ Screen.TwipsPerPixelX hScreen = Screen.Height \\ Screen.TwipsPerPixelY ‘定义截屏的长度和宽度等于屏幕实际长宽 Picture1.ScaleMode = vbPixels w = Picture1.ScaleWidth h = Picture1.ScaleHeight hdcScreen = GetDC(0)
r = StretchBlt(Picture1.hdc, 0, 0, w, h, hdcScreen, 0, 0, wScreen, hScreen, vbSrcCopy)
‘StretchBlt,函数名。该函数从源矩形中复制一个位图到目标矩形,必要时按目
标设备设置的模式进行图像的拉伸或压缩。
End Sub
Private Sub Command2_Click() ‘另存为按键代码 Me.Picture = Me.Image
CommonDialog1.Filter = \文件(*.bmp)|*.bmp|JPG文件(*.jpg)|*.jpg\
CommonDialog1.ShowSave
CommonDialog1.Flags = &H2 + &H4 + &H8 ‘&H2使用长文件名
2
&H4 隐藏只读复选框。
&H8强制对话框将对话框打开时的目录置成当前目录
If CommonDialog1.FileName <> \
SavePicture Me.Picture, CommonDialog1.FileName End If End Sub
Private Sub Command3_Click() ‘退出按键代码 Form3.Hide form6.Show End Sub 2.登陆部分
Option Explicit Dim Npass As Integer
Private Sub Command1_Click()
If username.Text = \And password.Text = \And Npass < 3 Then Form5.Hide Form2.Show Else
Npass = Npass + 1 If Npass = 3 Then MsgBox \你没有机会了\ End Else
MsgBox \密码第\错误! 请再试一次.\密码输入错误\
password.Text = \
3