|
4#
楼主 |
发表于 2013-1-13 08:08:01
|
只看该作者
调用的图片不能平铺
代码:
Private Sub CmdPic_Click()
SetBackGround CurrentProject.Path & "\login0.jpg"
模块
End SubPrivate Const GCL_HBRBACKGROUND = -10
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function CreatePatternBrush Lib "gdi32" (ByVal hBitmap As Long) As Long
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, ByVal lpRect As Any, ByVal bErase As Long) As Long
Public Sub SetBackGround(wpv_Arg As Variant)
Dim wlo_Image As Object
Dim wlv_Brush As Long
Dim wlv_Hwnd As Long
If Not IsNumeric(wpv_Arg) Then
Set wlo_Image = LoadPicture(wpv_Arg)
wlv_Brush = CreatePatternBrush(wlo_Image.Handle)
Set wlo_Image = Nothing
Else
wlv_Brush = CreateSolidBrush(wpv_Arg)
End If
wlv_Hwnd = FindWindowEx(Application.hWndAccessApp, 0, "MDIClient", vbNullString)
SetClassLong wlv_Hwnd, GCL_HBRBACKGROUND, wlv_Brush
InvalidateRect wlv_Hwnd, vbNullString, 1
End Sub
|
|