当前位置:编程学习 > VB >>

将图片「非重叠显示」填满整个表格视窗

 

 

 

 ----所需物件: PictureBox 一个。

 

 ----程式码(一):tile.bas

Declare Function BitBlt Lib "GDI" (ByVal hDestDC%, ByVal X%, ByVal Y%, _

ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, _

ByVal dwRop&) As Integer

 

 ----程式码(二):

Sub Form_Paint ()

    Const PIXEL = 3

    Picture1.ScaleMode = PIXEL

    Me.ScaleMode = PIXEL

    X% = 0: Y% = 0

    nWidth% = Picture1.Width

    nHeight% = Picture1.Height

    dwRop& = &HCC0020

    Do While Y% < ScaleHeight

        Do While X% < ScaleWidth

            Suc% = BitBlt(Me.hDC, X%, Y%, nWidth%, nHeight%, Picture1.hDC, 0, 0, dwRop&)

            X% = X% + nWidth%

        Loop

        X% = 0

        Y% = Y% + nHeight%

    Loop

End Sub

补充:软件开发 , Vb ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,