雨滴式的显示图片
2008-02-23 06:55:22来源:互联网 阅读 ()
Option Explicit
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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,ByVal dwRop As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Const SRCCOPY = &HCC0020
Private Picture1 As New StdPicture
Private Sub Command1_Click()
Dim i As Long
Dim j As Long
Dim height5 As Long, width5 As Long
Dim hMemDc As Long
'stdPicture物件的度量单位是Himetric所以要转换成Pixel
height5 = ScaleY(Picture1.Height, VBHimetric, vbPixels)
If height5 > Picture2.ScaleHeight Then
height5 = Picture2.ScaleHeight
End If
width5 = ScaleX(Picture1.Width, vbHimetric, vbPixels)
If width5 > Picture2.ScaleWidth Then
width5 = Picture2.ScaleWidth
End If
'Create Memory DC
hMemDc = CreateCompatibleDC(Picture2.hdc)
'将Picture1的BitMap图指定给hMemDc
Call SelectObject(hMemDc, Picture1.Handle)
For i = height5 To 1 Step -1
Call BitBlt(Picture2.hdc, 0, i, width5, 1, hMemDc, 0, i, SRCCOPY)
For j = i - 1 To 1 Step -1
Call BitBlt(Picture2.hdc, 0, j, width5, 1, hMemDc, 0, i, SRCCOPY)
Next j
Next
Call DeleteDC(hMemDc)
End Sub
Private Sub Form_Load()
Dim i As Long
Picture2.ScaleMode = 3 '设定成Pixel的度量单位
'设定待Display的图
Set Picture1 = LoadPicture("c:\Windows\素还真.bmp")
' ^^^^^^^^^^^^^^^^^^^^^^
' Load the picture we want to show
End Sub
上一篇: 如何设定墙纸的显示方式?
下一篇: 创建动态图标
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:如何交换鼠标按键
下一篇:用VB播放FLASH动画
- 雨滴式的显示图片 2018-06-17
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash