Hi zusammen
Also ich möchte ein Fenster erstellen, das man verschieben kann(nur an einem punkt), die Größe ändern kann(widht,height)(nur an einem punkt) und das nur den rahmen nicht durchsichtig hat. ich habe schon mit dem skript angefangen, aber trotz ist mir das ein bisschen zu schwrierig ^^.
Bitte verbessert + verfolltständigt das skript
Spoiler anzeigen
#include "DrawTransparent.au3"
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
$height = 200
$widht = 400
$x = 2
$y = 2
$x_form = 4
$y_form = 4
$child_wh = 15
$drag=GUICreate ("test", $widht+3, $height+3,$x_form,$y_form, $WS_POPUP, BitOR ( $WS_EX_TOPMOST, $WS_EX_COMPOSITED, $WS_EX_LAYERED ) )
GUISetBkColor(0x000000)
GUISetState()
$Ellipse_close_P = _DrawRect($drag,$x+3,$y+3,2,2)
$Ellipse_close = _DrawRect($drag,$x-5,$y-5,$child_wh,$child_wh,0x7EF955)
$Ellipse_select_P = _DrawRect($drag,$widht-6,$height-6,2,2)
$Ellipse_select = _DrawRect($drag,$widht-$child_wh+3,$height-$child_wh+3,$child_wh,$child_wh,0xFEF043)
$Ellipse = _DrawTransparentRect($drag,$x,$y, $widht-2, $height-2)
$Ellipse = _DrawTransparentRect($drag,$x+1,$y+1, $widht-2, $height-2)
While 1
$msg=GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
If WinActive($drag) Then
$_drag = MouseGetPos()
$x_drag = $_drag[0]
$y_drag = $_drag[1]
$_dragGUI = WinGetCaretPos()
$x_dragGUI = $_dragGUI[0]
$y_dragGUI = $_dragGUI[1]
$x_diff = $x_drag - $x_dragGUI
$y_diff = $y_drag - $x_dragGUI
If $x_diff < $child_wh And $y_diff < $child_wh Then
While _IsPressed(01)
$_drag = MouseGetPos()
$x_drag = $_drag[0]
$y_drag = $_drag[1]
WinMove($drag,"",$x_drag,$y_drag)
WEnd
EndIf
$_drag2 = GUIGetMsg(1)
$x_drag2 = $_drag2[3]
$y_drag2 = $_drag2[4]
If $x_drag2 <> 0 And Not StringInStr($x_drag2,"-") And $y_drag2 <> 0 And Not StringInStr($y_drag2,"-") And $x_drag2 < $widht And $y_drag2 < $height Then
;MsgBox(0,0,$x_drag2&" "&$y_drag2)
EndIf
EndIf
WEnd
Func _DrawRect($hwnd,$x,$y,$w,$h,$icolor = 0x000000)
$Child=GUICreate("",$w,$h,$x,$y,$WS_CHILD,-1,$hwnd)
GUISetBkColor($icolor, $Child)
GUISetState()
Return $Child
EndFunc
Die udf DrawTransperent:
Spoiler anzeigen
#include-once
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIError.au3>
;Global Const $WS_EX_COMPOSITED = 0x2000000
;Global Const $WS_EX_COMPOSITED = 0x2000000
Func _DrawTransparentEllipse($hwnd, $x,$y,$w,$h,$Transparency=255)
$Child=GUICreate ( "", $w, $h, $x, $y, $WS_CHILD, -1, $hwnd )
_WinAPI_SetLayeredWindowAttributes($hwnd, 0xABCDEF, $Transparency)
GUISetBkColor ( 0xABCDEF, $Child )
_GuiRoundCorners ( $Child, 0, 0, $w, $h)
GUISetState()
Return $Child
EndFunc
Func _DeletTransparentForm ( $Form )
If IsHWnd($Form) Then
$a=GUIDelete($Form)
Return $a
Else
$b=GUICtrlDelete($Form)
Return $b
EndIf
EndFunc
Func _DrawTransparentRect($hwnd, $x,$y,$w,$h,$Transparency=255)
$Child=GUICreate ( "", $w, $h, $x, $y, $WS_CHILD, -1, $hwnd)
_WinAPI_SetLayeredWindowAttributes($hwnd, 0xABCDEF, $Transparency)
GUISetBkColor (0xABCDEF, $Child)
GUISetState()
Return $Child
EndFunc
Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
; progandy
If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret[0] = 0
Return SetError(4, _WinAPI_GetLastError(), 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes
#cs
Func _WinAPI_GetLastError()
Local $aResult
$aResult = DllCall("Kernel32.dll", "int", "GetLastError")
If @error Then Return SetError(@error, 0, 0)
Return $aResult[0]
EndFunc ;==>_WinAPI_GetLastError
#ce
Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
Local $pos, $ret, $ret2
$pos = WinGetPos($hWnd)
$ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
If $ret[0] Then
$ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
If $ret2[0] Then
Return 1
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc
Func _DrawTransparentLine($hwnd, $X,$Y,$length,$course,$pensize=2,$Transparency=255)
_WinAPI_SetLayeredWindowAttributes($hwnd, 0xABCDEF, $Transparency)
$g1=GUICtrlCreateGraphic($X,$Y,0,0)
GUICtrlSetGraphic($g1, $GUI_GR_PENSIZE, $pensize )
GUICtrlSetGraphic($g1, $GUI_GR_COLOR,0xABCDEF, 0xABCDEF)
GUICtrlSetGraphic($g1, $GUI_GR_LINE, $length, $course)
GUICtrlSetGraphic($g1, $GUI_GR_REFRESH)
GUICtrlSetGraphic($g1, $GUI_GR_LINE, 1, 1)
Return $g1
EndFunc
thx im vorraus