Style für Fensterrahmen

  • Hallo nochmal!

    Schon wieder eine Frage :D :

    Ich habe es des öfteren gesehen, dass Leute einen speziellen Style für die Fensterrahmen anlegen. Wie geht das?

  • entweder mit XSkin oder du nimmst einfach den Style $WS_POPUP und mache es mit bilder und wie man einen Transparenten Ramen macht habe ich ja schon mal gepostet, wenn du es brauchst und es nicht findest Poste ich es nochmal.

    mfg. Jam00

  • Hier wieder mal von mir ein paar Style-Demos ;)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Color.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    $titel = "Funkey's Style-Test Example 1"
    $Form1 = GUICreate($titel, 400, 600, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetBkColor(0xffffff)

    [/autoit] [autoit][/autoit] [autoit]

    _GuiRoundCorners($Form1, 0, 0, 30, 30)
    _GuiMakeTransitionBorder($Form1, 55, 0xaa00ff, 0xffffff)
    _WinAPI_SetLayeredWindowAttributes($Form1, 0xffffff, 200)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $Form1)
    Sleep(3000)
    GUIDelete($Form1)

    [/autoit] [autoit][/autoit] [autoit]

    $titel = "Funkey's Style-Test Example 2"
    $Form1 = GUICreate($titel, 400, 600, -1, -1, $WS_POPUP)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    ;~ GUISetBkColor(0xffffff)

    [/autoit] [autoit][/autoit] [autoit]

    $Close_Label = GUICtrlCreateLabel("×", 350, 15, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 14, 0)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetTip(-1, 'Schließen')
    GUICtrlSetOnEvent(-1, '_Exit')

    [/autoit] [autoit][/autoit] [autoit]

    $Titel_Label = GUICtrlCreateLabel($titel, 0, 0, 400, 50, 0x4000201, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xffffff)

    [/autoit] [autoit][/autoit] [autoit]

    _GuiRoundCorners($Form1, 0, 0, 30, 30)
    _CreateColorTransition(0, 0, 400, 50, 0xFFFFFF, 0x0000FF, 0, 2)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Button1 = _GuiCreateRoundPicButton($Form1, 170, 100, 60, 150, '_Button', @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg')
    $Button2 = _GuiCreateRoundButton($Form1, 120, 300, 160, 50, '_Button', 0xFFFF00, 'Testbutton', 20)
    $Button3 = _GuiCreateRoundPicButton($Form1, 150, 400, 100, 100, '_Button', @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 'bla')

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Blaue Berge.jpg', 0, 50, 400, 550, 0x04000000)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $Form1)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(10000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Button()
    Switch @GUI_WinHandle
    Case $Button1[0]
    MsgBox(0, "Runder Button", "Button 1 wurde gedrückt")
    Case $Button2[0]
    MsgBox(0, "Runder Button", "Button 2 wurde gedrückt")
    Case $Button3[0]
    MsgBox(0, "Runder Button", "Button 3 wurde gedrückt")
    EndSwitch
    EndFunc ;==>_Button

    [/autoit] [autoit][/autoit] [autoit]

    Func _GuiCreateRoundPicButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $sFileBg, $sText = "", $iTextSize = -1)
    Return _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, -1, $sText, $iTextSize, 1, -1, $sFileBg)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GuiMakeTransitionBorder($hwnd, $iSize, $nColor_out, $nColor_in)
    ; funkey
    Local $Width, $Height, $aPos, $hGraphic
    Local $startRot, $startGruen, $startBlau, $endRot, $endGruen, $endBlau, $Color
    Local $ColorOffsetRot, $ColorOffsetGruen, $ColorOffsetBlau
    $aPos = WinGetPos($hwnd)
    $Width = $aPos[2]
    $Height = $aPos[3]
    $startRot = _ColorGetRed($nColor_out)
    $startGruen = _ColorGetGreen($nColor_out)
    $startBlau = _ColorGetBlue($nColor_out)
    $endRot = _ColorGetRed($nColor_in)
    $endGruen = _ColorGetGreen($nColor_in)
    $endBlau = _ColorGetBlue($nColor_in)
    $ColorOffsetRot = ($endRot - $startRot) / $iSize
    $ColorOffsetGruen = ($endGruen - $startGruen) / $iSize
    $ColorOffsetBlau = ($endBlau - $startBlau) / $iSize

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphic = GUICtrlCreateGraphic(0, 0, $Width, $Height, 0)
    For $i = 0 To $iSize - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0 + $i, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0 + $i, $Height - $i - 1)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i, $Height - $i - 1)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0 + $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $Height - $i)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Width - $i - 1, 0 + $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i - 1, $Height - $i)
    Next
    EndFunc ;==>_GuiMakeTransitionBorder

    [/autoit] [autoit][/autoit] [autoit]

    Func _CreateColorTransition($iPosx, $iPosy, $iWidth, $iHeight, $nColorStart, $nColorEnd, $iAlignment = 0, $iWaveFaktor = 1)
    ; funkey
    Local $startRot, $startGruen, $startBlau, $endRot, $endGruen, $endBlau, $Color
    Local $ColorOffsetRot, $ColorOffsetGruen, $ColorOffsetBlau, $Grafik
    $startRot = _ColorGetRed($nColorStart)
    $startGruen = _ColorGetGreen($nColorStart)
    $startBlau = _ColorGetBlue($nColorStart)
    $endRot = _ColorGetRed($nColorEnd)
    $endGruen = _ColorGetGreen($nColorEnd)
    $endBlau = _ColorGetBlue($nColorEnd)
    $Grafik = GUICtrlCreateGraphic($iPosx, $iPosy, $iWidth, $iHeight, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $iHeight += $iWaveFaktor - Mod($iHeight, $iWaveFaktor)
    Switch $iAlignment
    Case 0
    $ColorOffsetRot = ($endRot - $startRot) / ($iHeight / $iWaveFaktor)
    $ColorOffsetGruen = ($endGruen - $startGruen) / ($iHeight / $iWaveFaktor)
    $ColorOffsetBlau = ($endBlau - $startBlau) / ($iHeight / $iWaveFaktor)
    Switch Mod($iWaveFaktor, 2)
    Case 0
    For $w = 1 To $iWaveFaktor - 1 Step 2
    For $i = ($w - 1) * ($iHeight / $iWaveFaktor) To ($w) * ($iHeight / $iWaveFaktor) - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    For $i = $w * ($iHeight / $iWaveFaktor) To ($w + 1) * ($iHeight / $iWaveFaktor) - 1
    $Color = '0x' & Hex($endRot - $ColorOffsetRot * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2) & _
    Hex($endGruen - $ColorOffsetGruen * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2) & _
    Hex($endBlau - $ColorOffsetBlau * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    Next
    Case 1
    For $i = 0 To $iHeight - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    EndSwitch
    Case Else
    $ColorOffsetRot = ($endRot - $startRot) / ($iWidth / $iWaveFaktor)
    $ColorOffsetGruen = ($endGruen - $startGruen) / ($iWidth / $iWaveFaktor)
    $ColorOffsetBlau = ($endBlau - $startBlau) / ($iWidth / $iWaveFaktor)
    Switch Mod($iWaveFaktor, 2)
    Case 0
    For $w = 1 To $iWaveFaktor - 1 Step 2
    For $i = ($w - 1) * ($iWidth / $iWaveFaktor) To ($w) * ($iWidth / $iWaveFaktor) - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $iHeight)
    Next
    For $i = $w * ($iWidth / $iWaveFaktor) To ($w + 1) * ($iWidth / $iWaveFaktor) - 1
    $Color = '0x' & Hex($endRot - $ColorOffsetRot * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2) & _
    Hex($endGruen - $ColorOffsetGruen * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2) & _
    Hex($endBlau - $ColorOffsetBlau * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $iHeight)
    Next
    Next
    Case 1
    For $i = 0 To $iHeight - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    EndSwitch
    EndSwitch
    Return $Grafik
    EndFunc ;==>_CreateColorTransition

    [/autoit] [autoit][/autoit] [autoit]

    Func _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $iColor = -1, $sText = "", $iTextSize = -1, $iAlignment = 1, $iWaveFaktor = -1, $sFileBg = "")
    ; funkey
    Local $ret, $ret2, $Button[3]
    If $iColor = -1 Then $iColor = 0x000000
    If $iTextSize = -1 Then $iTextSize = 10
    If $iWaveFaktor = -1 Or (Mod($iWaveFaktor, 2) = 1 And $iWaveFaktor <> 1) Or $iWaveFaktor > 40 Then $iWaveFaktor = 2
    $Button[0] = GUICreate("", $iWidth, $iHeight, $iPosx, $iPosy, 0x41000000, -1, $hWndParent)
    WinMove($Button[0], "", $iPosx, $iPosy)
    GUISetCursor(0, 1)
    If $sFileBg <> "" Then
    $Button[2] = GUICtrlCreatePic($sFileBg, 0, 0, $iWidth, $iHeight, 0)
    Else
    If $iWaveFaktor = 0 Then
    GUISetBkColor($iColor)
    $Button[2] = GUICtrlCreateGraphic(0, 0, $iWidth, $iHeight, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_PENSIZE, 3)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x0)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $iWidth-1, $iHeight-1)
    Else
    $Button[2] = _CreateColorTransition(0, 0, $iWidth, $iHeight, $iColor, 0xFFFFFF, $iAlignment, $iWaveFaktor)
    EndIf
    EndIf
    $Button[1] = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x00000301, 0x00000008)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x0)
    GUICtrlSetFont(-1, $iTextSize, 1000)
    GUICtrlSetOnEvent(-1, $sFunc)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', 0, 'long', 0, 'long', $iWidth, 'long', $iHeight, 'long', $iHeight, 'long', $iWidth)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $Button[0], 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Else
    SetError(1)
    EndIf
    Else
    SetError(2)
    EndIf
    GUISetState()
    GUISwitch($hWndParent)
    Return $Button
    EndFunc ;==>_GuiCreateRoundButton

    [/autoit] [autoit][/autoit] [autoit]

    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 ;==>_GuiRoundCorners

    [/autoit] [autoit][/autoit] [autoit]

    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) ;modified by funkey
    Case Else
    Return 1
    EndSelect
    EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

    [/autoit]
  • @Deepred: Passiert das nur beim 1.Mal oder auch wenn du es noch mal startest?
    Und ich hab keine Ahnung, was da los ist. Aber die DLL ist ja auch noch Beta und nicht von mir... ;)

  • funkey: auch danke an dich! Das werde ich mir ebenfalls anschauen! Sehen beide aber gut aus (bie mir macht Vista auch so einen Fehler...)