实现图片平铺于窗体中
为了实现这一效果,请先把form的picture属性设为你想平铺的图片,然后把以下代码加入,就可以了(注意form的AutoRedraw必须为False)。
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 Const SRCCOPY = &HCC0020
Private Sub Form_Paint()
Dim x As Integer, y As Integer, d As Long
Dim pHeight As Integer, pWidth As Integer
ScaleMode = 3
pHeight = 32 ''这里最好设为图片的高度
pWidth = 32 ''这里设为图片的宽度
For x = 0 To ScaleWidth Step pWidth
For y = 0 To ScaleHeight Step pHeight
d = BitBlt(hDC, x, y, pWidth, pHeight, hDC, 0, 0, SRCCOPY)
Next y
Next x
End Sub
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论