Huhu allerseits,
gibt es eine Möglichkeit für ein GUI-Input ein Bild als Hintergrund festzulegen?
GUICtrlSetBkColor ist ja leider nur für eine einzige Farbe geeignet
Beste Grüße, AndyTR
Huhu allerseits,
gibt es eine Möglichkeit für ein GUI-Input ein Bild als Hintergrund festzulegen?
GUICtrlSetBkColor ist ja leider nur für eine einzige Farbe geeignet
Beste Grüße, AndyTR
GUICtrlSetImage
[/autoit]gibt es eine Möglichkeit für ein GUI-Input ein Bild als Hintergrund festzulegen?
Probiere es mal damit:
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("Test", 615, 438)
[/autoit] [autoit][/autoit] [autoit]$pic = GUICtrlCreatePic("raster_pink.bmp", 56, 64, 329, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$hGUI_Child = GUICreate("Test", 329, 21, 56, 64, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_MDICHILD + $WS_EX_LAYERED, $hGUI)
GUICtrlSetBkColor($hGUI_Child, 0xABCDEF)
$Input1 = GUICtrlCreateInput("", 0, 0, 329, 21, $WS_BORDER)
GUICtrlSetFont($Input1, 9, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor($Input1, 0xABCDEF)
GUISetState(@SW_SHOW, $hGUI_Child)
GUISetState(@SW_SHOW, $hGUI)
_WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0xABCDEF)
WinActivate($hGUI_Child)
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Gruß,
UEZ
Alle Vorschläge funktionieren bei mir leider nicht wie gewünscht
Grundgerüst sah bei mir übrigens so aus:
#include <WindowsConstants.au3>
#include <_WinAPI_SetLayeredWindowAttributes.au3>
HotKeySet("{ESC}", "_Exit")
[/autoit] [autoit][/autoit] [autoit]Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]$Hide_Window = GUICreate("Hide", 1, 1, 1, 1)
$GUI = GUICreate("", 80, 32, -1, -1, $WS_POPUP, $WS_EX_LAYERED, $Hide_Window)
GUISetBkColor(0xABCDEF)
GUISetFont(10, 100, -1, "Tahoma")
$Input_1 = GUICtrlCreateInput("", 0, 0, 80, 15)
GUICtrlSetOnEvent(-1, "_1")
GUICtrlSetBkColor(-1, 0x000000)
;GUICtrlSet...(-1, ...) , Erzeugung Hintergrundbild
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 7)
$Input_2 = GUICtrlCreateInput("", 0, 17, 80, 15, -1)
GUICtrlSetOnEvent(-1, "_2")
GUICtrlSetBkColor(-1, 0x000000)
;GUICtrlSet...(-1, ...) , Erzeugung Hintergrundbild
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 7)
_WinAPI_SetLayeredWindowAttributes($GUI, 0xABCDEF, 200)
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func _1()
Global $Input_1_Text = GUICtrlRead($Input_1)
GUICtrlSetData($Input_1, "")
MsgBox(0, "", "1: " & "''" & $Input_1_Text & "''")
EndFunc
Func _2()
Global $Input_2_Text = GUICtrlRead($Input_2)
GUICtrlSetData($Input_2, "")
MsgBox(0, "", "2: " & "''" & $Input_2_Text & "''")
EndFunc
Func _Exit()
Exit
EndFunc
Wenn keine weitere Möglichkeit mehr gibt, dann werde ich es wohl sein lassen müssen...
Dennoch schonmal danke für die Lösungsansätze und vllt weiß noch jemand eine Möglichkeit
Grüße...
Ich verstehe nicht ganz genau, was du machen willst! Willst du 2 Input Felder haben, die durchsichtig sind, so dass der Hintergrund sichtbar ist?
Falls ja, dann probiere mal dies:
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("Test", 229, 44, -1, -1, $WS_POPUP, $WS_EX_TOPMOST+ $WS_EX_LAYERED)
$Input1 = GUICtrlCreateInput("", 0, 0, 229, 21)
GUICtrlSetFont($Input1, 9, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor($Input1, 0xABCDEF)
$Input2 = GUICtrlCreateInput("", 0, 23, 229, 21)
GUICtrlSetFont($Input2, 9, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor($Input2, 0xABCDEF)
GUISetState(@SW_SHOW, $hGUI)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($hGUI)
Exit
EndSwitch
WEnd
Gruß,
UEZ
Deine Idee ist interessant, UEZ, aber ich möchte einen "eigenen" Input-Box-Hintergund des Scripts, also quasi da, wo der schwarze BG is ein Image
Is es bei Deiner Transparenz-Lösung eig normal, dass wenn ein Input neu-fokussiert werden soll, dies quasi nicht möglich ist, denn es sieht interessant aus, hatte ich auch schonmal probiert
Grüße
Nächster Versuch! Hier ein Mischmasch aus den beiden Versionen!
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "_Exit")
Global Const $SC_DRAGMOVE = 0xF012
[/autoit] [autoit][/autoit] [autoit]$hGUI = GUICreate("Test", 82, 34, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xFEDCBA, $hGUI)
$pic1 = GUICtrlCreatePic("back1.jpg", 0, 0, 78, 14)
GUICtrlSetState(-1, $GUI_DISABLE)
$pic2 = GUICtrlCreatePic("back2.jpg", 0, 18, 78, 14)
GUICtrlSetState(-1, $GUI_DISABLE)
$hGUI_Child = GUICreate("", 82, 32, 0, 0, $WS_POPUP, $WS_EX_MDICHILD +$WS_EX_LAYERED, $hGUI)
GUICtrlSetBkColor($hGUI_Child, 0xABCDEF)
$Input1 = GUICtrlCreateInput("", 0, 0, 82, 16)
GUICtrlSetOnEvent(-1, "_1")
GUICtrlSetFont($Input1, 8, 800, 0, "Tahoma")
GUICtrlSetBkColor($Input1, 0xABCDEF)
$Input2 = GUICtrlCreateInput("", 0, 18, 82, 16)
GUICtrlSetOnEvent(-1, "_2")
GUICtrlSetFont($Input2, 8, 800, 0, "Tahoma")
GUICtrlSetBkColor($Input2, 0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xFEDCBA)
_WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0xABCDEF)
GUISetState(@SW_SHOW, $hGUI_Child)
GUISetState(@SW_SHOW, $hGUI)
WinActivate($hGUI_Child)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
While Sleep(10000)
WEnd
Func _1()
Local $Input_1_Text = GUICtrlRead($Input1)
GUICtrlSetData($Input1, "")
MsgBox(0, "", "1: " & "''" & $Input_1_Text & "''")
EndFunc
Func _2()
Local $Input_2_Text = GUICtrlRead($Input2)
GUICtrlSetData($Input2, "")
MsgBox(0, "", "2: " & "''" & $Input_2_Text & "''")
EndFunc
Func _Exit()
GUIDelete($hGUI)
Exit
EndFunc
Gruß,
UEZ
Guten Tag,
noch ein Versuch:
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
Const $IMAGE_BITMAP = 0x0000
Const $STM_SETIMAGE = 0x0172
Const $STM_GETIMAGE = 0x0173
GUICreate("Dummy")
$Pic = "C:\Programme\AutoIt3\Examples\Gui\msoobe.jpg"
$idPIC = GUICtrlCreatePic($Pic, 0, 0, 198, 18)
$hBitmap = GUICtrlSendMsg($idPIC, $STM_GETIMAGE, $IMAGE_BITMAP, 0)
$aR = DllCall("Gdi32.dll", "Handle", "CreatePatternBrush", "Handle", $hBitmap)
$hBrush = $aR[0]
$hGUI = GUICreate("Test", 400, 100)
$idINP = GUICtrlCreateInput("Test", 20, 20, 200, 20)
$hINP = GUICtrlGetHandle(-1)
$InputColor = 0xFFFFFF
GUICtrlCreateInput("", 20, 60, 200, 20)
GUIRegisterMsg($WM_CTLCOLOREDIT, "ColorInput")
GUISetState()
While True
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
DllCall("Gdi32.dll", "BOOL", "DeleteObject", "Handle", $hBrush)
Exit
EndSwitch
WEnd
Func ColorInput($hWnd, $iMsg, $wParam, $lParam)
If $lParam = $hINP Then
DllCall("Gdi32.dll", "UINT", "SetTextColor", "Handle", $wParam, "UInt", $InputColor)
DllCall("Gdi32.dll", "Int", "SetBkMode", "Handle", $wParam, "Int", 1)
Return $hBrush
EndIf
Return $GUI_RUNDEFMSG
EndFunc
Das is super, Großvater, dank Dir
Aber natürlich auch danke für die Lösungsansätze der anderen, Grüße
Klasse Beispiel Großvater
Gruß,
UEZ
Super Beispiel @Großvater.
Ich hab aber noch eine Frage:
Wie bekomme ich es hin, das der Hintegrund des Edits beim verschieben außerhalb des sichtbaren Bereiches und
beim zurückfühlen innerhalb des sichtbarn Bereiches neu gezeichnet wird?
Im augenblick wird der Hintergrund erst korret gezeichnet, wenn man wieder mit der Maus über das Input geht.
Ich denke das wird auch über eine Message gehen, aber hab keinen Plan welche ich auswerten muß.
Ich habe weder in meiner WinXP VM noch unter Win7 x64 das Problem!
Gruß,
UEZ
Habe es unter Win7 getestet, WinXp hab ich gerade nicht zur Hand.
Wenn ich die GUI aus dem Sichtbreich bewege und wieder zurückführe sieht das dann so aus:
autoit.de/wcf/attachment/12658/
Erst wenn man mit der Maus auf das Input kommt oder z.B. das Aktive Fenster gewechselt wird, dann wird
der Hintergrund neu gezeichnet.
Stimmt!
Ich habe nicht genau hingesehen!
Gruß,
UEZ
Ich habe eben mal den WinXP Schlepptop angeschmissen, da funzt es einwandfrei.
Wieder so ein AERO-Fehler würde ich mal sagen.
Probiere mal das hier aus:
;coded by Großvater
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Const $IMAGE_BITMAP = 0x0000
Const $STM_SETIMAGE = 0x0172
Const $STM_GETIMAGE = 0x0173
GUICreate("Dummy")
$au3path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")
$Pic = $au3path & "\Examples\GUI\msoobe.jpg"
$idPIC = GUICtrlCreatePic($Pic, 0, 0, 198, 18)
$hBitmap = GUICtrlSendMsg($idPIC, $STM_GETIMAGE, $IMAGE_BITMAP, 0)
$aR = DllCall("Gdi32.dll", "Handle", "CreatePatternBrush", "Handle", $hBitmap)
$hBrush = $aR[0]
$hGUI = GUICreate("Test", 400, 100)
$idINP = GUICtrlCreateInput("", 20, 20, 200, 20)
$hINP = GUICtrlGetHandle($idINP)
$InputColor = 0xFFFFFF
GUICtrlCreateInput("", 20, 60, 200, 20)
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg($WM_CTLCOLOREDIT, "ColorInput")
If @OSBuild > 5999 Then GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")
GUISetState()
[/autoit] [autoit][/autoit] [autoit]While True
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
DllCall("Gdi32.dll", "BOOL", "DeleteObject", "Handle", $hBrush)
Exit
EndSwitch
WEnd
Func ColorInput($hWnd, $iMsg, $wParam, $lParam)
If $lParam = $hINP Then
DllCall("Gdi32.dll", "UINT", "SetTextColor", "Handle", $wParam, "UInt", $InputColor)
DllCall("Gdi32.dll", "Int", "SetBkMode", "Handle", $wParam, "Int", 1)
Return $hBrush
EndIf
Return $GUI_RUNDEFMSG
EndFunc
Func WM_ERASEBKGND($hWnd, $iMsg, $wParam, $lParam)
_WinAPI_RedrawWindow($hGUI, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
Return 1
EndFunc
Gruß,
UEZ
Danke UEZ, so klappts.
Ich muss mich hier leider nochmal melden...
Bekomme es leider nicht hin zwei BG's für zwei Inputs einzurichten...
Wie sähe Großvaters Beispiel denn in dem Fall aus für beide Inputs jeweils das Beispiel-Image zu setzen?
Grüße, Andy
#include <WindowsConstants.au3>
[/autoit] [autoit][/autoit] [autoit]Const $IMAGE_BITMAP = 0x0000
Const $STM_SETIMAGE = 0x0172
Const $STM_GETIMAGE = 0x0173
GUICreate("Dummy")
$Pic = "C:\Programme\AutoIt3\Examples\Gui\msoobe.jpg"
$idPIC = GUICtrlCreatePic($Pic, 0, 0, 198, 18)
$hBitmap = GUICtrlSendMsg($idPIC, $STM_GETIMAGE, $IMAGE_BITMAP, 0)
$aR = DllCall("Gdi32.dll", "Handle", "CreatePatternBrush", "Handle", $hBitmap)
$hBrush = $aR[0]
$hGUI = GUICreate("Test", 400, 100)
$idINP = GUICtrlCreateInput("Test", 20, 20, 200, 20)
$hINP = GUICtrlGetHandle(-1)
$InputColor = 0xFFFFFF
GUICtrlCreateInput("", 20, 60, 200, 20)
$hINP1 = GUICtrlGetHandle(-1)
GUIRegisterMsg($WM_CTLCOLOREDIT, "ColorInput")
GUISetState()
While True
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
DllCall("Gdi32.dll", "BOOL", "DeleteObject", "Handle", $hBrush)
Exit
EndSwitch
WEnd
Func ColorInput($hWnd, $iMsg, $wParam, $lParam)
If $lParam = $hINP Or $lParam = $hInp1 Then
DllCall("Gdi32.dll", "UINT", "SetTextColor", "Handle", $wParam, "UInt", $InputColor)
DllCall("Gdi32.dll", "Int", "SetBkMode", "Handle", $wParam, "Int", 1)
Return $hBrush
EndIf
Return $GUI_RUNDEFMSG
EndFunc