Jump to content

Simple MouseOver effect on a picture?


GraaF
 Share

Recommended Posts

So i got this GUI, which has a button in form of a picture, now i would like that incase i mouseover the button, it changes to another picture, to get that hover effect.

 

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 294, 265, 665, 290)
$Pic1 = GUICtrlCreatePic("GUI\picture1.bmp", 48, 144, 193, 97)
$Label1 = GUICtrlCreateLabel("Standard text label..", 96, 16, 98, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd


To clairfy:

Whenever i mouseover $pic1 i would like $pic1 to change from "picture1" to "picture2" and once i remove my mouse i would like to switch back to "picture1"

I've been looking for something like this, but have been unable to find anything useful.

Link to comment
Share on other sites

Try this:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 294, 265, 665, 290)
$Pic1 = GUICtrlCreatePic("GUI\picture1.bmp", 48, 144, 193, 97)
$Label1 = GUICtrlCreateLabel("Standard text label..", 96, 16, 98, 17)
GUISetState(@SW_SHOW)

Global $fHover = False

While 1
    $nMsg = GUIGetMsg()
    $aInfo = GUIGetCursorInfo($Form1)
    If Not @error Then $idHover = $aInfo[4]
    If $idHover = $Pic1 Then
        GUICtrlSetImage($Pic1, 'THE_OTHER.BMP')
        $fHover = True
    Else
        If $fHover Then
            $fHover = False
            GUICtrlSetImage($Pic1, 'GUI\picture1.bmp')
        EndIf
    EndIf
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

Best Regards BugFix  

Link to comment
Share on other sites

Instead of tracking the mouse over an image you could set an image list for a button.

#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

HotKeySet("{F1}", ToggleDisable)

_GDIPlus_Startup()

;~ Global $hImageListExample = CreateImageListFromMemory(Normal(), Hot(), Pressed(), Disabled())
Global $hImageListExample = CreateImageListFromImages(@ScriptDir & "\Normal.jpg", @ScriptDir & "\Hot.jpg", @ScriptDir & "\Pressed.jpg", @ScriptDir & "\Disabled.jpg")

Global $hMain = GUICreate("Example", 200, 100)
Global $btnExample = GUICtrlCreateButton("", 68, 10, 64, 64)
GUICtrlCreateLabel("Press F1 to enable/disable the button", 10, 80)

_GUICtrlButton_SetImageList(GUICtrlGetHandle($btnExample), $hImageListExample, 4)

GUISetState(@SW_SHOW, $hMain)

While (True)
    Switch (GUIGetMsg())
        Case $GUI_EVENT_CLOSE
            _GDIPlus_Shutdown()
            _GUIImageList_Destroy($hImageListExample)
            Exit 0
        Case $btnExample
            MsgBox("", "Pressed", "Button pressed")
    EndSwitch
WEnd

Func ToggleDisable()
    Local Static $bEnable = True
    $bEnable = Not $bEnable
    GUICtrlSetState($btnExample, ($bEnable ? $GUI_ENABLE : $GUI_DISABLE))
EndFunc

Func CreateImageListFromImages($sNormal, $sHot = "", $sPresed = "", $sDisabled = "")
    Local $hTmpBitmap = _GDIPlus_BitmapCreateFromFile($sNormal)
    If (@error) Then Return SetError(2, 0, 0)
    Local $hListReturn = _GUIImageList_Create(_GDIPlus_ImageGetWidth($hTmpBitmap), _GDIPlus_ImageGetHeight($hTmpBitmap))
    If ($hListReturn = 0) Then Return SetError(1, _GDIPlus_BitmapDispose($hTmpBitmap), ConsoleWrite("[Error] Could not create image list." & @CRLF))

    Local $hBitmapNormal = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hTmpBitmap)
    Local $hBitmapHot = Null
    Local $hBitmapPressed = Null
    Local $hBitmapDisabled = Null

    _GDIPlus_BitmapDispose($hTmpBitmap)

    If ($sHot = "") Then
        $hBitmapHot = $hBitmapNormal
    Else
        $hTmpBitmap = _GDIPlus_BitmapCreateFromFile($sHot)
        $hBitmapHot = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hTmpBitmap)
        _GDIPlus_BitmapDispose($hTmpBitmap)
    EndIf
    If ($sPresed = "") Then
        $hBitmapPressed = $hBitmapNormal
    Else
        $hTmpBitmap = _GDIPlus_BitmapCreateFromFile($sPresed)
        $hBitmapPressed = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hTmpBitmap)
        _GDIPlus_BitmapDispose($hTmpBitmap)
    EndIf
    If ($sDisabled = "") Then
        $hBitmapDisabled = $hBitmapNormal
    Else
        $hTmpBitmap = _GDIPlus_BitmapCreateFromFile($sDisabled)
        $hBitmapDisabled = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hTmpBitmap)
        _GDIPlus_BitmapDispose($hTmpBitmap)
    EndIf
    If (_GUIImageList_Add($hListReturn, $hBitmapNormal) = -1) Then ConsoleWrite("[Error] Error adding normal bitmap to list." & @CRLF)
    If (_GUIImageList_Add($hListReturn, $hBitmapHot) = -1) Then ConsoleWrite("[Error] Error adding hot bitmap to list." & @CRLF)
    If (_GUIImageList_Add($hListReturn, $hBitmapPressed) = -1) Then ConsoleWrite("[Error] Error adding pressed bitmap to list." & @CRLF)
    If (_GUIImageList_Add($hListReturn, $hBitmapDisabled) = -1) Then ConsoleWrite("[Error] Error adding disabled bitmap to list." & @CRLF)
    For $i = 4 To 6
        _GUIImageList_Add($hListReturn, $hBitmapNormal)
    Next
    _WinAPI_DeleteObject($hBitmapNormal)
    _WinAPI_DeleteObject($hBitmapHot)
    _WinAPI_DeleteObject($hBitmapPressed)
    _WinAPI_DeleteObject($hBitmapDisabled)
    Return $hListReturn
EndFunc

Func CreateImageListFromMemory($xStringNormal, $xStringHot = "", $xStringPressed = "", $xStringDisabled = "")
    Local $hTmpBitmap = _GDIPlus_BitmapCreateFromMemory($xStringNormal)
    If (@error) Then Return SetError(2, 0, 0)
    Local $hListReturn = _GUIImageList_Create(_GDIPlus_ImageGetWidth($hTmpBitmap), _GDIPlus_ImageGetHeight($hTmpBitmap))
    If ($hListReturn = 0) Then Return SetError(1, _GDIPlus_BitmapDispose($hTmpBitmap), ConsoleWrite("[Error] Could not create image list." & @CRLF))

    Local $hBitmapNormal = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hTmpBitmap)
    Local $hBitmapHot = _GDIPlus_BitmapCreateFromMemory(($xStringHot = "" ? $xStringNormal : $xStringHot), True)
    Local $hBitmapPressed = _GDIPlus_BitmapCreateFromMemory(($xStringPressed = "" ? $xStringNormal : $xStringPressed), True)
    Local $hBitmapDisabled = _GDIPlus_BitmapCreateFromMemory(($xStringDisabled = "" ? $xStringNormal : $xStringDisabled), True)
    _GDIPlus_BitmapDispose($hTmpBitmap)
    If (_GUIImageList_Add($hListReturn, $hBitmapNormal) = -1) Then ConsoleWrite("[Error] Error adding normal bitmap to list." & @CRLF)
    If (_GUIImageList_Add($hListReturn, $hBitmapHot) = -1) Then ConsoleWrite("[Error] Error adding hot bitmap to list." & @CRLF)
    If (_GUIImageList_Add($hListReturn, $hBitmapPressed) = -1) Then ConsoleWrite("[Error] Error adding pressed bitmap to list." & @CRLF)
    If (_GUIImageList_Add($hListReturn, $hBitmapDisabled) = -1) Then ConsoleWrite("[Error] Error adding disabled bitmap to list." & @CRLF)
    For $i = 4 To 6
        _GUIImageList_Add($hListReturn, $hBitmapNormal)
    Next
    _WinAPI_DeleteObject($hBitmapNormal)
    _WinAPI_DeleteObject($hBitmapHot)
    _WinAPI_DeleteObject($hBitmapPressed)
    _WinAPI_DeleteObject($hBitmapDisabled)
    Return $hListReturn
EndFunc   ;==>CreateImageListFromMemory

;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2015-01-20

Func Disabled()
    Local $Disabled
    $Disabled &= 'sLYA/9j/4QAYRXgAaWYAAElJKgAECAAHAP/sABFEAHVja3kAAQAEBQA8PABI4QMvaHQAdHA6Ly9ucy4AYWRvYmUuY28AbS94YXAvMS4AMC8APD94cGEAY2tldCBiZWcAaW49Iu+7vyIAIGlkPSJXNU0AME1wQ2VoaUgAenJlU3pOVGMAemtjOWQiPz4AIDx4OnhtcG0AZXRhIHhtbG6gczp4PSICXDoACxEB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8CO62ugMMa5GjRwCLHtx49sWrFgCHjbtqNAAKDwBXrNq9ae1eQQBy1cBV0YaggwDMEGgybMcPkQCxSBPgF/8AgABYFHBPlZbXgAAnnpryNAswjADVN1trAnsF3ABQaK/IXgOv+QB3FAwoB2b5sgDtStt8Bg25MAD3fmLII11+WACOQ+6AdiGJyADIJbypTsINtwD/ALF0nV7j/gCioJ6nXUmg1wBjRrEaxbjx7QCLVm0Atu2o0AAAKDrQVB4vWQC1ftPZvILlqwCAq6MNQQeBBABQZLmGHydikgAnwfIwCwZLigBPlZfXgCR8/gCWoF2E5ta3WwBrBnME3FB6sQDgLwHUfl3FBwCs1wq1u9ozIQAoTckHEDgLoAB0b8uxoM+x7ACHccd3Fj4t/gC/LwlxH1GuhwBDwPJhQbHtewCkPdIVuZDfzgDL/wA1PVWHQgAoProKg5SZMQDix7kiRcFqxQCh5XLjHQACgwAjy3Lpe/yxEgAgdYAYLYsKDwCV1tdAzAcyegAKBjhGEptKLAD56htyceicxQCQRyHdiOZ+hwDIMKAjm2FJuwDbabCUJuSDiADkLoHQ/l2NAAAMdyLccd3FvQBb/UW8ZcVuGgDp8HkwoNi2zQDOHucK3MiXBRDLNwfY4hA7SpUAHiR7kmTcFqwAWh5XLjcAAKAAyLLMtmZBLWIAxVdY'
    $Disabled &= 'KuBHjqAAl7jE6BmA5k8AQUDPCcIt7SgAs+eofc3HqvMAWyD0Hd+5+h8EIL6ARAhm2E29ANbbToKhNxQeAMvIXQOh/LsaAAA45kW4Y7uLAHqxslvGVFbhAeAh/BhQfVleWQA3IZixoyusFRBwseMoQVMGYDkAseg6UDXCcJsAe0W1nTlD7m4APVeBWyCP0r2A27t9DuQXUKJdAA/NsJt7qjT4ACoTcVHuo4C8AAdD+XY0HvCsACbez21mzlFzAHRxwHArZBHFAFT1Y/3N9DhxBCC2QBM//9k='
    $Disabled = _WinAPI_Base64Decode($Disabled)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($Disabled) & ']')
    DllStructSetData($tSource, 1, $Disabled)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 2019)
    $tSource = 0
    Local Const $bString = Binary(DllStructGetData($tDecompress, 1))
    Return $bString
EndFunc   ;==>Disabled

Func Hot()
    Local $Hot
    $Hot &= 'ZbsA/9j/4QAYRXgAaWYAAElJKgAECAAHAP/sABFEAHVja3kAAQAEBQA8PABI4QMvaHQAdHA6Ly9ucy4AYWRvYmUuY28AbS94YXAvMS4AMC8APD94cGEAY2tldCBiZWcAaW49Iu+7vyIAIGlkPSJXNU0AME1wQ2VoaUgAenJlU3pOVGMAemtjOWQiPz4AIDx4OnhtcG0AZXRhIHhtbG6gczp4PSICXDoACxEBFi8iIAIidGs9BCJBARggWE1QIABDb3JlIDUuNgAtYzExMSA3OQAuMTU4MzI1LAAgMjAxNS8wOQAvMTAtMDE6MaAwOjIwIAQAIgBtgHJkZjpSREYEawmABj0iBGp3d3cuAHczLm9yZy8xADk5OS8wMi8yBDItgBAtc3ludEBheC1ucyOFIEQAZXNjcmlwdGkIb24ggQdhYm91mHQ9IoBUA2FtcAYrk5KVCBRNTRsVbW2GFjBzdFJlh1eSFnNUAHlwZS9SZXNvUHVyY2UAFyMBHnAAOkNyZWF0b3IQVG9vbIWiUGhvAHRvc2hvcCBDAkNCTSAoV2luZBBvd3MpwgxNTToASW5zdGFuY2UQSUQ9IkAELmlpAGQ6RTI1MzVEADE3NzJBMjExAEU2QjI3QkJEAEY5RTE3MTM2BDk4xQ5Eb2N1bahlbnTFDmTHDjjWDgOBg0MPZXJpdmVkIEZyb20ggj06aa3XIjXXIsMOZNciNtYO+i8AIy8Me4UEQJCBAoauUwADBr9lbkC8coC2/4juAA6CWgBkwIDQAAH/2wCEAAYEAAQEBQQGBQUGBAkGwAALCAYGCAALDAoKCwoKDAQQDAIAEAwODxAADw4MExMUFBOAExwbGxscHwYAAAEHBwcNDA0YABAQGBoVERUaA0cGJAD/wAARCAAAQABAAwERAAIAEQEDEQH/xAAAkgABAQEAAw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H6YUQBvcOhdtC6J3gA7PB3KEeY3sgCx48eYK0/YLwD2u/WqG522YQA1NMP5K33I4wBGXUYo4pWvbgDzci4rfWMtrACmKQUcPFRqXgCbhcKK3UU1dQB0y09JTqXmmQDOSqo/roMbOQXxEvH3EqeR+SLnAL0uSW+3pIloAEkC0dEoJknkACfCruq55sc/ACrp88T13dumADQcq7Jh/D8XAG6MySEGWnE7ADNGgatJzpS4CKOJ4QAT4vCLLQEFEx1VT2MhHqag07DpmWYFExgFEwDv+OgepzAJmABio1WBCsCEZwDK/FEO44Hu9gCUEV8iXN4x0QBqVH2n4OPtOgD2P6Lr2y6g3gBvNtVlhjExtABwilNYT7fxpAB6oc2Pvi87JgD2/kZqUv7dxgDe+a5+E5HIHyBLrocKbTAmtWcAC6F3ns0PcocALxUqx3jKCvcA8jcj3Te1zSgAKCORLSkgShoAFATJNIT4Vd0AVz8Ttn5VHb4AfXG91dumdQcALmC+XsHYIu0Q0RkkIAMhNWk5ANKvFHE8O2oUALvd0WW/yr5EAOjJSqw6qp7GAEI6Mw/avTMsAM7Ky6fE7m2KABsTYnN4TDCaAEA9+s/50D1PQJ0AS8MVHNFvKwACFYEIy5Y4ogAdwxSXi0RrHQDyNc5Yxkq1KgCjsdPcGh17HQAwuvbIScTebQCqzwxic2hEMwAawnJ/n8al2QDFPFEG2YUu1wBkWbcEq+VejACUqsMiiHsZCADo7j9q9My2bACshGN53NsWmACbE7rxxii8oAAfV+s6tA9T50BA1JwwUerhYf8A2Q=='
    $Hot = _WinAPI_Base64Decode($Hot)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($Hot) & ']')
    DllStructSetData($tSource, 1, $Hot)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 3117)
    $tSource = 0
    Local Const $bString = Binary(DllStructGetData($tDecompress, 1))
    Return $bString
EndFunc   ;==>Hot

Func Normal()
    Local $Normal
    $Normal &= 'hroA/9j/4QAYRXgAaWYAAElJKgAECAAHAP/sABFEAHVja3k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ADyDMBqx6DpWAPqtVfm3+ltvAKLdw4m/kF9NAGq1JnpAxgOHEG/S3iRQDA4JfgDP2cmLRZs1QxDkXHxXMFqDu3cAPsPVLRqKMuMAEk3yntv5nyEA1X6f08MqMWUA3zHtv5nyHMowqkKUqoJkQlFnpgBJGmwlC5BR8wJRUC+/27GjtaoAKJxiR/J7r0UANQafGZBliFkAKO69Z7P2fbwAVbEyYA+SccgAaiyD+lft3b0Ah65UaijLj1sBQWfmfIdc9P6fABlRiSb5j29BANeZ8hutJUUgAEoVUpVSl//Z'
    $Normal = _WinAPI_Base64Decode($Normal)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($Normal) & ']')
    DllStructSetData($tSource, 1, $Normal)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 2914)
    $tSource = 0
    Local Const $bString = Binary(DllStructGetData($tDecompress, 1))
    Return $bString
EndFunc   ;==>Normal

Func Pressed()
    Local $Pressed
    $Pressed &= 'YbsA/9j/4QAYRXgAaWYAAElJKgAECAAHAP/sABFEAHVja3kAAQAEBQA8PABI4QMvaHQAdHA6Ly9ucy4AYWRvYmUuY28AbS94YXAvMS4AMC8APD94cGEAY2tldCBiZWcAaW49Iu+7vyIAIGlkPSJXNU0AME1wQ2VoaUgAenJlU3pOVGMAemtjOWQiPz4AIDx4OnhtcG0AZXRhIHhtbG6gczp4PSICXDoACxEBFi8iIAIidGs9BCJBARggWE1QIABDb3JlIDUuNgAtYzExMSA3OQAuMTU4MzI1LAAgMjAxNS8wOQAvMTAtMDE6MaAwOjIwIAQAIgBtgHJkZjpSREYEawmABj0iBGp3d3cuAHczLm9yZy8xADk5OS8wMi8yBDItgBAtc3ludEBheC1ucyOFIEQAZXNjcmlwdGkIb24ggQdhYm91mHQ9IoBUA2FtcAYrk5KVCBRNTRsVbW2GFjBzdFJlh1eSFnNUAHlwZS9SZXNvUHVyY2UAFyMBHnAAOkNyZWF0b3IQVG9vbIWiUGhvAHRvc2hvcCBDAkNCTSAoV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vCHB9NswCp0vl8RKjdMwin6rpxB4xxkZgAaUg5PIP7V0wAy+lzXPVvKi0ANYMD618zyyEA3nGApGWdOJkQpvYh6WIHf//Z'
    $Pressed = _WinAPI_Base64Decode($Pressed)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($Pressed) & ']')
    DllStructSetData($tSource, 1, $Pressed)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 3140)
    $tSource = 0
    Local Const $bString = Binary(DllStructGetData($tDecompress, 1))
    Return $bString
EndFunc   ;==>Pressed

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize)
    $tOutput = DllStructCreate("byte[" & $iBufferSize & "]")
    If @error Then Return SetError(1, 0, 0)
    Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0)
    If @error Then Return SetError(2, 0, 0)
    If $aRet[0] Then Return SetError(3, $aRet[0], 0)
    Return $aRet[6]
EndFunc   ;==>_WinAPI_LZNTDecompress

(CreateImageListFromMemory is from a script I wrote a while back, I added the FromImages in case it was too complicated or you didn't want to use a Base64 string)

(You can turn your images to a base64 string using Uez's program from here)

Normal.jpg

Hot.jpg

Pressed.jpg

Disabled.jpg

Link to comment
Share on other sites

 

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

GUICreate("", 100, 200, -1, -1)
$iPIC1 = GUICtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", 0, 0, 100, 100)
$iPIC2 = GUICtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\logo4.gif", 0, 100, 100, 100)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MOUSEMOVE
            Local $aCursor = GUIGetCursorInfo()
            _ImageHover($iPIC1, @ProgramFilesDir & "\AutoIt3\Examples\GUI\logo4.gif", @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", $aCursor)
            _ImageHover($iPIC2, @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", @ProgramFilesDir & "\AutoIt3\Examples\GUI\logo4.gif", $aCursor)
    EndSwitch
WEnd

Func _ImageHover($iCtrl, $iIMG_1, $i_IMG2, ByRef $aCursor)
    If ($aCursor[4] = $iCtrl) Then
        GUICtrlSetImage($iCtrl, $iIMG_1)
    ElseIf ($aCursor[4] <> $iCtrl) Then
        GUICtrlSetImage($iCtrl, $i_IMG2)
    EndIf
EndFunc   ;==>_ImageHover

 

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...