如何固定一个窗体的背景图片,让它不受滚动的影响?
在窗体中我用了一个图片做为窗体的背景,但是当滚动条出现时,滚动条也可以控制这个图片,把图片拉到别的位置,很不美观,有什么办法解决吗? #include <GUIConstantsEx.au3>#include <WindowsConstants.au3>
#include "GUIScrollbars_Ex.au3"
#include <winapi.au3>
Local $msg, $form1, $pic, $chlid
Local $x = 400, $y = 100
$form1 = GUICreate("My GUI", 400, 400, $x, $y)
$pic = GUICtrlCreatePic("1.jpg", 0, 0, 400, 400)
GUICtrlSetState(-1, $gui_disable)
$chlid = GUICreate("MY Chlid", 400 - 3, 300, $x + 3, $y + 30, $WS_POPUPWINDOW, $WS_EX_LAYERED, $form1)
$button1=GUICtrlCreateButton("ok", 10, 10)
GUISetState(@SW_SHOW, $chlid)
GUISetState(@SW_SHOW, $form1)
GUISetBkColor(0xabcdef, $chlid)
_WinAPI_SetLayeredWindowAttributes($chlid, 0xabcdef, 255)
_GUIScrollbars_Generate($chlid, 0, 400)
GUIRegisterMsg($WM_MOVE, "shift_child")
_SendMessage($form1, $WM_NCACTIVATE, 1)
While 1
$msg = GUIGetMsg()
Switch $msg
case -3
Exit
case $button1
msgbox(0,0,"ok")
EndSwitch
WEnd
Func shift_child($hwnd, $msg, $wparam, $lparam)
If $hwnd = $form1 Then
Local $wp = WinGetPos($form1)
WinMove($chlid, '', $wp + 3, $wp + 30)
EndIf
EndFunc
谢谢3M,这个要好好研究一下了。 回复 3# awfymwvf
建议楼主在标题中写上已解决
页:
[1]