afeen

add more hover-button (Done)

5 posts in this topic

#1 ·  Posted (edited)

Back to UEZ gui example , I just want to add more hover-button like "search" button .

Code:#Include <WindowsConstants.au3>
#Include <GUIConstantsEx.au3>
#include <GDIPLus.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

_GDIPlus_Startup()
Global $__hGUI_, $__iInput_, $__hGUI_Glow, $__bPlayAnim = False
Global Const $fDeg = 180 / ACos(-1), $fRad = ACos(-1) / 180

ModernSearchGUI(800, 300)

_GDIPlus_Shutdown()

Func ModernSearchGUI($iW = @DesktopWidth, $iH = @DesktopHeight)
Local Const $iBgColor = 0x151515
$iW = $iW < (346 + 2 * 220 + 3) ? (346 + 2 * 220 + 3) : $iW
$iH = $iH < 2 * 84 ? 2 * 84 : $iH
$__hGUI_ = GUICreate("", $iW, $iH, ($iW <> @DesktopWidth) ? (@DesktopWidth - $iW) / 2 : 0, ($iH <> @DesktopHeight) ? (@DesktopHeight - $iH) / 2 : 0, BitOR($WS_TABSTOP, $WS_POPUP), $WS_EX_TOPMOST)
GUISetBkColor($iBgColor)
Local Const $iW_Frame = 346, $iH_Frame = 84
Local Const $iPosX = Int(($iW - $iW_Frame) / 2), $iPosY = Int($iH / 4)
Local Const $iPicFrame = GUICtrlCreatePic("", $iPosX, $iPosY, $iW_Frame, $iH_Frame)
GUICtrlSetState(-1, $GUI_DISABLE)
Local Const $iStripLeft = GUICtrlCreatePic("", $iPosX - 220, $iPosY + $iH_Frame / 2, 220, 2)
Local Const $iStripRight = GUICtrlCreatePic("", $iPosX + $iW_Frame, $iPosY + $iH_Frame / 2, 220, 2)

Local $hBmp = _GDIPlus_BitmapCreateFromScan0(220, 2), $hHBmp
Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)

#Region l/r strips
Local Const $hBrushL1 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF151515, 0xFF0A0A0A, 1)
Local Const $hBrushR1 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF0A0A0A, 0xFF151515, 1)
Local Const $hBrushL2 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF151515, 0xFF2F2F2F, 1)
Local Const $hBrushR2 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF2F2F2F, 0xFF151515, 1)
_GDIPlus_GraphicsFillRect($hCtxt, 0, 0, 220, 1, $hBrushL1)
_GDIPlus_GraphicsFillRect($hCtxt, 0, 1, 220, 1, $hBrushL2)
$hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
_WinAPI_DeleteObject(GUICtrlSendMsg($iStripLeft, 0x0172, $IMAGE_BITMAP, $hHBmp))
_WinAPI_DeleteObject($hHBmp)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_ImageRotateFlip($hBmp, 4)
$hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
_WinAPI_DeleteObject(GUICtrlSendMsg($iStripRight, 0x0172, $IMAGE_BITMAP, $hHBmp))
_WinAPI_DeleteObject($hHBmp)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_BrushDispose($hBrushL1)
_GDIPlus_BrushDispose($hBrushL2)
_GDIPlus_BrushDispose($hBrushR1)
_GDIPlus_BrushDispose($hBrushR2)
#EndRegion

#Region Frame
$hBmp = _GDIPlus_BitmapCreateFromScan0($iW_Frame, $iH_Frame)
$hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999))
_GDIPlus_GraphicsClear($hCtxt, 0xFF000000 + $iBgColor)
Local $hBrushBg = _GDIPlus_LineBrushCreate($iW_Frame / 2, 0, $iW_Frame / 2, $iH_Frame, 0xFF1F1F1F, 0xFF101010, 1)
_GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW_Frame, $iH_Frame, $hBrushBg)

Local $hPath = _GDIPlus_PathCreate()
Local Const $hPen = _GDIPlus_PenCreate(0xFF000000)
Local $aPoints[9][2] = [[8]], $iCorner = 3
;outer border
$aPoints[1][0] = $iCorner
$aPoints[1][1] = 0
$aPoints[2][0] = $iW_Frame - $iCorner
$aPoints[2][1] = 0
$aPoints[3][0] = $iW_Frame - 1
$aPoints[3][1] = $iCorner
$aPoints[4][0] = $iW_Frame - 1
$aPoints[4][1] = $iH_Frame - $iCorner
$aPoints[5][0] = $iW_Frame - $iCorner - 1
$aPoints[5][1] = $iH_Frame - 1
$aPoints[6][0] = $iCorner
$aPoints[6][1] = $iH_Frame - 1
$aPoints[7][0] = 0
$aPoints[7][1] = $iH_Frame - $iCorner
$aPoints[8][0] = 0
$aPoints[8][1] = $iCorner
_GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025)
_GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen)

;inner border
_GDIPlus_PathReset($hPath)
_GDIPlus_PenSetColor($hPen, 0xFF272727)
$aPoints[1][0] = $iCorner
$aPoints[1][1] = 1
$aPoints[2][0] = $iW_Frame - $iCorner
$aPoints[2][1] = 1
$aPoints[3][0] = $iW_Frame - 2
$aPoints[3][1] = $iCorner
$aPoints[4][0] = $iW_Frame - 2
$aPoints[4][1] = $iH_Frame - $iCorner
$aPoints[5][0] = $iW_Frame - $iCorner - 2
$aPoints[5][1] = $iH_Frame - 2
$aPoints[6][0] = $iCorner
$aPoints[6][1] = $iH_Frame - 2
$aPoints[7][0] = 1
$aPoints[7][1] = $iH_Frame - $iCorner
$aPoints[8][0] = 1
$aPoints[8][1] = $iCorner
_GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025)
_GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen)

$hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPicFrame, 0x0172, $IMAGE_BITMAP, $hHBmp))
_WinAPI_DeleteObject($hHBmp)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_BrushDispose($hBrushBg)
#EndRegion

#Region input box
Local Const $iPicBg = GUICtrlCreatePic("", $iPosX + ($iW_Frame - 304) / 2 - 8, $iPosY + 12, 320, 60)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $hPicBg = GUICtrlGetHandle($iPicBg)

_GDIPlus_PathReset($hPath)
_GDIPlus_PenSetColor($hPen, 0xFF000000)
_GDIPlus_PenSetWidth($hPen, 2)
$aPoints[0][0] = 4
$aPoints[1][0] = 310
$aPoints[1][1] = 48
$aPoints[2][0] = 308
$aPoints[2][1] = 50
$aPoints[3][0] = 11
$aPoints[3][1] = 50
$aPoints[4][0] = 8
$aPoints[4][1] = 48
$hBmp = _GDIPlus_BitmapCreateFromScan0(320, 60)
$hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999))
_GDIPlus_PathAddCurve2($hPath, $aPoints, 0.025)
_GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) ;draw shadow

_GDIPlus_PathReset($hPath)
_GDIPlus_PenSetColor($hPen, 0xFF686868)
_GDIPlus_PenSetWidth($hPen, 1)
$aPoints[0][0] = 8
$aPoints[1][0] = 11
$aPoints[1][1] = 8
$aPoints[2][0] = 308
$aPoints[2][1] = 8
$aPoints[3][0] = 311
$aPoints[3][1] = 11
$aPoints[4][0] = 311
$aPoints[4][1] = 45
$aPoints[5][0] = 308
$aPoints[5][1] = 48
$aPoints[6][0] = 11
$aPoints[6][1] = 48
$aPoints[7][0] = 8
$aPoints[7][1] = 45
$aPoints[8][0] = 8
$aPoints[8][1] = 11
_GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025) ;draw round rectangle
_GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen)
Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF2B2B2B)
_GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush)
_GDIPlus_GraphicsDrawLine($hCtxt, 230, 8, 230, 48, $hPen)
_GDIPlus_PenSetColor($hPen, 0xFF000000)
_GDIPlus_GraphicsDrawLine($hCtxt, 231, 8, 231, 48, $hPen)

$hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPicBg, 0x0172, $IMAGE_BITMAP, $hHBmp))

_GDIPlus_PathDispose($hPath)
_GDIPlus_PenDispose($hPen)
_GDIPlus_BrushDispose($hBrush)
_WinAPI_DeleteObject($hHBmp)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_BitmapDispose($hBmp)

$__iInput_ = GUICtrlCreateInput("What are you looking for?", 12 + $iPosX + ($iW_Frame - 304) / 2, $iPosY + ($iH_Frame - 18) / 2, 195, 18, $ES_AUTOHSCROLL, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Arial", 5)
GUICtrlSetColor(-1, 0x888888)
GUICtrlSetBkColor(-1, 0x2B2B2B)
Local Const $iBtn = GUICtrlCreateLabel("Search", $iPosX + 245, $iPosY + 21, 78, 39, BitOR($SS_CENTER, $SS_CENTERIMAGE, $WS_TABSTOP))
GUICtrlSetFont(-1, 11, 400, 0, "Arial", 5)
GUICtrlSetColor(-1, 0xF0F0F0)
GUICtrlSetBkColor(-1, 0x2B2B2B)
ControlFocus($__hGUI_ , "", $iBtn)

$__hGUI_Glow = GUICreate("", $iW_Frame, $iH_Frame, $iPosX, $iPosY, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TRANSPARENT, $WS_EX_LAYERED), $__hGUI_)
GUISetBkColor(0x00011, $__hGUI_Glow)
Local Const $iPic_Glow = GUICtrlCreatePic("", 14, 15, 236, 57)
GUICtrlSetState(-1, $GUI_DISABLE)

$hBmp = _GDIPlus_BitmapCreateFromScan0(239, 57)
$hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt, 4 + (@OSBuild > 5999))
_GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)

Local Const $hRegion = _GDIPlus_RegionCreateFromRect(0, 0, $iW_Frame, $iH_Frame)
_GDIPlus_RegionCombineRect($hRegion, 18, 20, 195, 18, 3)
_GDIPlus_GraphicsSetClipRegion($hCtxt, $hRegion)

$hBrushBg = _GDIPlus_LineBrushCreate($iW_Frame / 2, 0, $iW_Frame / 2, $iH_Frame, 0xFF1F1F1F, 0xFF101010, 1)
_GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW_Frame, $iH_Frame, $hBrushBg)
$hBrush = _GDIPlus_BrushCreateSolid(0xFF2B2B2B)
_GDIPlus_GraphicsFillRect($hCtxt, 10, 13, 220, 36, $hBrush)

_GDIPlus_GlowCreate($hCtxt, 10, 8, 10, 49, 8)
_GDIPlus_GlowCreate($hCtxt, 233, 8, 233, 49, 8)
_GDIPlus_GlowCreate($hCtxt, 8, 8, 236, 8)
_GDIPlus_GlowCreate($hCtxt, 8, 49, 236, 49)

$hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic_Glow, 0x0172, $IMAGE_BITMAP, $hHBmp))

_GDIPlus_BrushDispose($hBrushBg)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_RegionDispose($hRegion)
_WinAPI_DeleteObject($hHBmp)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_BitmapDispose($hBmp)

#EndRegion

GUISetState(@SW_SHOW, $__hGUI_)
GUISetState(@SW_SHOW, $__hGUI_Glow)

_WinAPI_SetLayeredWindowAttributes($__hGUI_Glow, 0x00011, 0x00)

GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
AdlibRegister("PlayGlowAnim", 30)
Local $iMpos, $iBState = 0
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
AdlibUnRegister("PlayGlowAnim")
GUIDelete()
Return 1
Case $iBtn
MsgBox(0, "Test", GUICtrlRead($__iInput_), 0, $__hGUI_ )
EndSwitch
$iMpos = GUIGetCursorInfo($__hGUI_ )[4]
Switch $iMpos
Case $iBtn
If Not $iBState Then
GUICtrlSetColor($iBtn, 0x55FF55)
GUICtrlSetBkColor($iBtn, 0x383838)
$iBState = 1
EndIf
Case Else
If $iBState Then
$iBState = 0
GUICtrlSetColor($iBtn, 0xF0F0F0)
GUICtrlSetBkColor($iBtn, 0x2B2B2B)
EndIf
EndSwitch
Until False
EndFunc

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
Switch $hWnd
Case $__hGUI_
Switch BitAND($wParam, 0xFFFF)
Case $__iInput_
Switch BitShift($wParam, 16)
Case $EN_KILLFOCUS
$__bPlayAnim = False
WinSetTrans($__hGUI_Glow, "", 0)
If GUICtrlRead($__iInput_) = "" Then Return GUICtrlSetData($__iInput_, "What are you looking for?") * 0
Case $EN_SETFOCUS
$__bPlayAnim = True
If GUICtrlRead($__iInput_) = "What are you looking for?" Then GUICtrlSetData($__iInput_, "")
Return 0
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

Func _GDIPlus_GlowCreate(ByRef $hGraphics, $iX1, $iY1, $iX2, $iY2, $iSize = 16, $iCInner = 0x6010FF10) ;coded by UEZ build 2015-01-09 beta
Local Const $fAngle = ATan(($iY2 - $iY1) / ($iX2 - $iX1)) * $fDeg ;calculate the angle of the 2 points
Local Const $iW = Round(Sqrt(($iY2 - $iY1) ^ 2 + ($iX2 - $iX1) ^ 2), 0), $iH = $iW ;length between the 2 points

Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)

Local Const $hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2)
_GDIPlus_MatrixRotate($hMatrix, $fAngle + 90)
_GDIPlus_MatrixTranslate($hMatrix, -$iW / 2, -$iH / 2)
_GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix)

Local Const $hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddRectangle($hPath, ($iW - $iSize) / 2 - $iSize / 2, 0, $iSize * 2, $iH)
$hBrush_Glow = _GDIPlus_LineBrushCreate(($iW - $iSize) / 2, 0, ($iH + $iSize) / 2, 0, 0, 0)
Local $aColorGradient[4][2], $iCOuter = 0x00000000
$aColorGradient[0][0] = 3
$aColorGradient[1][0] = $iCOuter
$aColorGradient[1][1] = 0.0
$aColorGradient[2][0] = $iCInner
$aColorGradient[2][1] = 0.5
$aColorGradient[3][0] = $iCOuter
$aColorGradient[3][1] = 1.0
_GDIPlus_LineBrushSetPresetBlend($hBrush_Glow, $aColorGradient)
_GDIPlus_GraphicsFillRect($hCtxt, ($iW - $iSize) / 2, 0, $iSize, $iH, $hBrush_Glow)

Local $fDX, $fDY
If $fAngle <= 180 Then ;adjust position
$fDX = $iX2 - ($iW / 2 + Cos($fAngle * $fRad) * $iW / 2)
$fDY = $iY2 - ($iH / 2 + Sin($fAngle * $fRad) * $iH / 2)
Else
$fDX = $iX1 - ($iW / 2 + Cos($fAngle * $fRad) * $iW / 2)
$fDY = $iY1 - ($iH / 2 + Sin($fAngle * $fRad) * $iH / 2)
EndIf
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, $fDX, $fDY, $iW, $iH)

_GDIPlus_PathDispose($hPath)
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_BrushDispose($hBrush_Glow)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_BitmapDispose($hBitmap)
EndFunc ;==>_GDIPlus_GlowCreate

Func PlayGlowAnim()
If $__bPlayAnim Then
Local Static $fTransparency = 0x40, $iDir = 1
_WinAPI_SetLayeredWindowAttributes($__hGUI_Glow, 0x00011, $fTransparency < 0x40 ? 0x40: $fTransparency > 0xFF ? 0xFF : $fTransparency)
$fTransparency += 8 * $iDir
If $fTransparency < 0x40 Or $fTransparency > 0xFF Then $iDir *= -1
EndIf
EndFunc
When I copy and paste, 2 button still blinking. Please help me to fix it ! Thanks. Edited by afeen
Added code tags

Share this post


Link to post
Share on other sites



afeen,

When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

As I mentioned in the >original topic the version is only a proof of concept version that means modifying the original example will not be easy. Further as Yashied already said it is easier to use a skin udf probably to create such kind of GUIs.

 

Anyhow here the modification adding an additional "button" without any graphical gimmicks.

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPLus.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

_GDIPlus_Startup()
Global $__hGUI_, $__iInput_, $__hGUI_Glow, $__bPlayAnim = False
Global Const $fDeg = 180 / ACos(-1), $fRad = ACos(-1) / 180

ModernSearchGUI()

_GDIPlus_Shutdown()

Func ModernSearchGUI($iW = @DesktopWidth, $iH = @DesktopHeight)
    Local Const $iBgColor = 0x151515
    $iW = $iW < (346 + 2 * 220 + 3) ? (346 + 2 * 220 + 3) : $iW
    $iH = $iH < 2 * 84 ? 2 * 84 : $iH
    $__hGUI_ = GUICreate("", $iW, $iH, ($iW <> @DesktopWidth) ? (@DesktopWidth - $iW) / 2 : 0, ($iH <> @DesktopHeight) ? (@DesktopHeight - $iH) / 2 : 0, BitOR($WS_TABSTOP, $WS_POPUP), $WS_EX_TOPMOST)
    GUISetBkColor($iBgColor)
    Local Const $iW_Frame = 346, $iH_Frame = 84
    Local Const $iPosX = Int(($iW - $iW_Frame) / 2), $iPosY = Int($iH / 4)
    Local Const $iPicFrame = GUICtrlCreatePic("", $iPosX, $iPosY, $iW_Frame, $iH_Frame)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Local Const $iStripLeft = GUICtrlCreatePic("", $iPosX - 220, $iPosY + $iH_Frame / 2, 220, 2)
    Local Const $iStripRight = GUICtrlCreatePic("", $iPosX + $iW_Frame, $iPosY + $iH_Frame / 2, 220, 2)

    Local $hBmp = _GDIPlus_BitmapCreateFromScan0(220, 2), $hHBmp
    Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)

    #Region l/r strips
    Local Const $hBrushL1 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF151515, 0xFF0A0A0A, 1)
    Local Const $hBrushR1 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF0A0A0A, 0xFF151515, 1)
    Local Const $hBrushL2 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF151515, 0xFF2F2F2F, 1)
    Local Const $hBrushR2 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF2F2F2F, 0xFF151515, 1)
    _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, 220, 1, $hBrushL1)
    _GDIPlus_GraphicsFillRect($hCtxt, 0, 1, 220, 1, $hBrushL2)
    $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iStripLeft, 0x0172, $IMAGE_BITMAP, $hHBmp))
    _WinAPI_DeleteObject($hHBmp)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_ImageRotateFlip($hBmp, 4)
    $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iStripRight, 0x0172, $IMAGE_BITMAP, $hHBmp))
    _WinAPI_DeleteObject($hHBmp)
    _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_BrushDispose($hBrushL1)
    _GDIPlus_BrushDispose($hBrushL2)
    _GDIPlus_BrushDispose($hBrushR1)
    _GDIPlus_BrushDispose($hBrushR2)
    #EndRegion l/r strips

    #Region Frame
    $hBmp = _GDIPlus_BitmapCreateFromScan0($iW_Frame, $iH_Frame)
    $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999))
    _GDIPlus_GraphicsClear($hCtxt, 0xFF000000 + $iBgColor)
    Local $hBrushBg = _GDIPlus_LineBrushCreate($iW_Frame / 2, 0, $iW_Frame / 2, $iH_Frame, 0xFF1F1F1F, 0xFF101010, 1)
    _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW_Frame, $iH_Frame, $hBrushBg)

    Local $hPath = _GDIPlus_PathCreate()
    Local Const $hPen = _GDIPlus_PenCreate(0xFF000000)
    Local $aPoints[9][2] = [[8]], $iCorner = 3
    ;outer border
    $aPoints[1][0] = $iCorner
    $aPoints[1][1] = 0
    $aPoints[2][0] = $iW_Frame - $iCorner
    $aPoints[2][1] = 0
    $aPoints[3][0] = $iW_Frame - 1
    $aPoints[3][1] = $iCorner
    $aPoints[4][0] = $iW_Frame - 1
    $aPoints[4][1] = $iH_Frame - $iCorner
    $aPoints[5][0] = $iW_Frame - $iCorner - 1
    $aPoints[5][1] = $iH_Frame - 1
    $aPoints[6][0] = $iCorner
    $aPoints[6][1] = $iH_Frame - 1
    $aPoints[7][0] = 0
    $aPoints[7][1] = $iH_Frame - $iCorner
    $aPoints[8][0] = 0
    $aPoints[8][1] = $iCorner
    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025)
    _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen)

    ;inner border
    _GDIPlus_PathReset($hPath)
    _GDIPlus_PenSetColor($hPen, 0xFF272727)
    $aPoints[1][0] = $iCorner
    $aPoints[1][1] = 1
    $aPoints[2][0] = $iW_Frame - $iCorner
    $aPoints[2][1] = 1
    $aPoints[3][0] = $iW_Frame - 2
    $aPoints[3][1] = $iCorner
    $aPoints[4][0] = $iW_Frame - 2
    $aPoints[4][1] = $iH_Frame - $iCorner
    $aPoints[5][0] = $iW_Frame - $iCorner - 2
    $aPoints[5][1] = $iH_Frame - 2
    $aPoints[6][0] = $iCorner
    $aPoints[6][1] = $iH_Frame - 2
    $aPoints[7][0] = 1
    $aPoints[7][1] = $iH_Frame - $iCorner
    $aPoints[8][0] = 1
    $aPoints[8][1] = $iCorner
    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025)
    _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen)

    $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPicFrame, 0x0172, $IMAGE_BITMAP, $hHBmp))
    _WinAPI_DeleteObject($hHBmp)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_BrushDispose($hBrushBg)
    #EndRegion Frame

    #Region input box
    Local Const $iPicBg = GUICtrlCreatePic("", $iPosX + ($iW_Frame - 304) / 2 - 8, $iPosY + 12, 320, 60)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Local $hPicBg = GUICtrlGetHandle($iPicBg)

    _GDIPlus_PathReset($hPath)
    _GDIPlus_PenSetColor($hPen, 0xFF000000)
    _GDIPlus_PenSetWidth($hPen, 2)
    $aPoints[0][0] = 4
    $aPoints[1][0] = 310
    $aPoints[1][1] = 48
    $aPoints[2][0] = 308
    $aPoints[2][1] = 50
    $aPoints[3][0] = 11
    $aPoints[3][1] = 50
    $aPoints[4][0] = 8
    $aPoints[4][1] = 48
    $hBmp = _GDIPlus_BitmapCreateFromScan0(320, 60)
    $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999))
    _GDIPlus_PathAddCurve2($hPath, $aPoints, 0.025)
    _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) ;draw shadow

    _GDIPlus_PathReset($hPath)
    _GDIPlus_PenSetColor($hPen, 0xFF686868)
    _GDIPlus_PenSetWidth($hPen, 1)
    $aPoints[0][0] = 8
    $aPoints[1][0] = 11
    $aPoints[1][1] = 8
    $aPoints[2][0] = 308
    $aPoints[2][1] = 8
    $aPoints[3][0] = 311
    $aPoints[3][1] = 11
    $aPoints[4][0] = 311
    $aPoints[4][1] = 45
    $aPoints[5][0] = 308
    $aPoints[5][1] = 48
    $aPoints[6][0] = 11
    $aPoints[6][1] = 48
    $aPoints[7][0] = 8
    $aPoints[7][1] = 45
    $aPoints[8][0] = 8
    $aPoints[8][1] = 11
    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025) ;draw round rectangle
    _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF2B2B2B)
    _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush)
    _GDIPlus_GraphicsDrawLine($hCtxt, 230, 8, 230, 48, $hPen)
    _GDIPlus_PenSetColor($hPen, 0xFF000000)
    _GDIPlus_GraphicsDrawLine($hCtxt, 231, 8, 231, 48, $hPen)

    $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPicBg, 0x0172, $IMAGE_BITMAP, $hHBmp))

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _WinAPI_DeleteObject($hHBmp)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BitmapDispose($hBmp)

    $__iInput_ = GUICtrlCreateInput("What are you looking for?", 12 + $iPosX + ($iW_Frame - 304) / 2, $iPosY + ($iH_Frame - 18) / 2, 195, 18, $ES_AUTOHSCROLL, 0)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial", 5)
    GUICtrlSetColor(-1, 0x888888)
    GUICtrlSetBkColor(-1, 0x2B2B2B)
    Local Const $iBtn = GUICtrlCreateLabel("Search", $iPosX + 245, $iPosY + 21, 78, 39, BitOR($SS_CENTER, $SS_CENTERIMAGE, $WS_TABSTOP))
    GUICtrlSetFont(-1, 11, 400, 0, "Arial", 5)
    GUICtrlSetColor(-1, 0xF0F0F0)
    GUICtrlSetBkColor(-1, 0x2B2B2B)
    ControlFocus($__hGUI_, "", $iBtn)

    Local Const $iBtnX = GUICtrlCreateLabel("Exit", $iPosX + 245, $iPosY + 121, 78, 39, BitOR($SS_CENTER, $SS_CENTERIMAGE, $WS_TABSTOP))
    GUICtrlSetFont(-1, 11, 400, 0, "Arial", 5)
    GUICtrlSetColor(-1, 0xF0F0F0)
    GUICtrlSetBkColor(-1, 0x2B2B2B)
    ControlFocus($__hGUI_, "", $iBtn)


    $__hGUI_Glow = GUICreate("", $iW_Frame, $iH_Frame, $iPosX, $iPosY, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TRANSPARENT, $WS_EX_LAYERED), $__hGUI_)
    GUISetBkColor(0x00011, $__hGUI_Glow)
    Local Const $iPic_Glow = GUICtrlCreatePic("", 14, 15, 236, 57)
    GUICtrlSetState(-1, $GUI_DISABLE)

    $hBmp = _GDIPlus_BitmapCreateFromScan0(239, 57)
    $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 4 + (@OSBuild > 5999))
    _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)

    Local Const $hRegion = _GDIPlus_RegionCreateFromRect(0, 0, $iW_Frame, $iH_Frame)
    _GDIPlus_RegionCombineRect($hRegion, 18, 20, 195, 18, 3)
    _GDIPlus_GraphicsSetClipRegion($hCtxt, $hRegion)

    $hBrushBg = _GDIPlus_LineBrushCreate($iW_Frame / 2, 0, $iW_Frame / 2, $iH_Frame, 0xFF1F1F1F, 0xFF101010, 1)
    _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW_Frame, $iH_Frame, $hBrushBg)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFF2B2B2B)
    _GDIPlus_GraphicsFillRect($hCtxt, 10, 13, 220, 36, $hBrush)

    _GDIPlus_GlowCreate($hCtxt, 10, 8, 10, 49, 8)
    _GDIPlus_GlowCreate($hCtxt, 233, 8, 233, 49, 8)
    _GDIPlus_GlowCreate($hCtxt, 8, 8, 236, 8)
    _GDIPlus_GlowCreate($hCtxt, 8, 49, 236, 49)

    $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_Glow, 0x0172, $IMAGE_BITMAP, $hHBmp))

    _GDIPlus_BrushDispose($hBrushBg)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_RegionDispose($hRegion)
    _WinAPI_DeleteObject($hHBmp)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BitmapDispose($hBmp)

    #EndRegion input box

    GUISetState(@SW_SHOW, $__hGUI_)
    GUISetState(@SW_SHOW, $__hGUI_Glow)

    _WinAPI_SetLayeredWindowAttributes($__hGUI_Glow, 0x00011, 0x00)

    GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
    AdlibRegister("PlayGlowAnim", 30)
    Local $iMpos, $iBState = 0
    Do
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $iBtnX
                AdlibUnRegister("PlayGlowAnim")
                GUIDelete()
                Return 1
            Case $iBtn
                MsgBox(0, "Test", GUICtrlRead($__iInput_), 0, $__hGUI_)
        EndSwitch
        $iMpos = GUIGetCursorInfo($__hGUI_)[4]
        Switch $iMpos
            Case $iBtn
                If Not $iBState Then
                    GUICtrlSetColor($iBtn, 0x55FF55)
                    GUICtrlSetBkColor($iBtn, 0x383838)
                    $iBState = 1
                EndIf
            Case $iBtnX
                If Not $iBState Then
                    GUICtrlSetColor($iBtnX, 0xFF5555)
                    GUICtrlSetBkColor($iBtnX, 0x383838)
                    $iBState = 1
                EndIf
            Case Else
                If $iBState Then
                    $iBState = 0
                    GUICtrlSetColor($iBtn, 0xF0F0F0)
                    GUICtrlSetBkColor($iBtn, 0x2B2B2B)
                    GUICtrlSetColor($iBtnX, 0xF0F0F0)
                    GUICtrlSetBkColor($iBtnX, 0x2B2B2B)
                EndIf
        EndSwitch
    Until False
EndFunc   ;==>ModernSearchGUI

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    Switch $hWnd
        Case $__hGUI_
            Switch BitAND($wParam, 0xFFFF)
                Case $__iInput_
                    Switch BitShift($wParam, 16)
                        Case $EN_KILLFOCUS
                            $__bPlayAnim = False
                            WinSetTrans($__hGUI_Glow, "", 0)
                            If GUICtrlRead($__iInput_) = "" Then Return GUICtrlSetData($__iInput_, "What are you looking for?") * 0
                        Case $EN_SETFOCUS
                            $__bPlayAnim = True
                            If GUICtrlRead($__iInput_) = "What are you looking for?" Then GUICtrlSetData($__iInput_, "")
                            Return 0
                    EndSwitch
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Func _GDIPlus_GlowCreate(ByRef $hGraphics, $iX1, $iY1, $iX2, $iY2, $iSize = 16, $iCInner = 0x6010FF10) ;coded by UEZ build 2015-01-09 beta
    Local Const $fAngle = ATan(($iY2 - $iY1) / ($iX2 - $iX1)) * $fDeg ;calculate the angle of the 2 points
    Local Const $iW = Round(Sqrt(($iY2 - $iY1) ^ 2 + ($iX2 - $iX1) ^ 2), 0), $iH = $iW ;length between the 2 points

    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)

    Local Const $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2)
    _GDIPlus_MatrixRotate($hMatrix, $fAngle + 90)
    _GDIPlus_MatrixTranslate($hMatrix, -$iW / 2, -$iH / 2)
    _GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix)

    Local Const $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddRectangle($hPath, ($iW - $iSize) / 2 - $iSize / 2, 0, $iSize * 2, $iH)
    $hBrush_Glow = _GDIPlus_LineBrushCreate(($iW - $iSize) / 2, 0, ($iH + $iSize) / 2, 0, 0, 0)
    Local $aColorGradient[4][2], $iCOuter = 0x00000000
    $aColorGradient[0][0] = 3
    $aColorGradient[1][0] = $iCOuter
    $aColorGradient[1][1] = 0.0
    $aColorGradient[2][0] = $iCInner
    $aColorGradient[2][1] = 0.5
    $aColorGradient[3][0] = $iCOuter
    $aColorGradient[3][1] = 1.0
    _GDIPlus_LineBrushSetPresetBlend($hBrush_Glow, $aColorGradient)
    _GDIPlus_GraphicsFillRect($hCtxt, ($iW - $iSize) / 2, 0, $iSize, $iH, $hBrush_Glow)

    Local $fDX, $fDY
    If $fAngle <= 180 Then ;adjust position
        $fDX = $iX2 - ($iW / 2 + Cos($fAngle * $fRad) * $iW / 2)
        $fDY = $iY2 - ($iH / 2 + Sin($fAngle * $fRad) * $iH / 2)
    Else
        $fDX = $iX1 - ($iW / 2 + Cos($fAngle * $fRad) * $iW / 2)
        $fDY = $iY1 - ($iH / 2 + Sin($fAngle * $fRad) * $iH / 2)
    EndIf
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, $fDX, $fDY, $iW, $iH)

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_BrushDispose($hBrush_Glow)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BitmapDispose($hBitmap)
EndFunc   ;==>_GDIPlus_GlowCreate

Func PlayGlowAnim()
    If $__bPlayAnim Then
        Local Static $fTransparency = 0x40, $iDir = 1
        _WinAPI_SetLayeredWindowAttributes($__hGUI_Glow, 0x00011, $fTransparency < 0x40 ? 0x40 : $fTransparency > 0xFF ? 0xFF : $fTransparency)
        $fTransparency += 8 * $iDir
        If $fTransparency < 0x40 Or $fTransparency > 0xFF Then $iDir *= -1
    EndIf
EndFunc   ;==>PlayGlowAnim
Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

@Melba :The optimist sees the rose and not its thorns,

the pessimist stares at the thorns, oblivious to the rose.

@yashied : thanks fo'ya suggestion.

@UEZ : yheaaaa thanks a lot mastah. Thanks for the quick response . And it finish my curiosity . I have given a solution by the right GdiMaster. I <3 AutoIt.

Share this post


Link to post
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