Jump to content

[Resolved] GUI design advisement for a scrolling arc style HUD


Recommended Posts

Greetings!

I am developing a menu that will be laid out in an arc style similar to the image you see below:

Posted Image

No, it will not have ANYTHING to do with WoW, TOR or any other video game.

My question is, what would be the best way to go about creating an arc (maybe not so drastic of an arc shown above, maybe 5 -10deg worth, kinda like these parenthesis "( )".) list style of icons that the user could scroll up and down?

I've downloaded the extended WinAPI UDF and the OnHover UDF for various other parts of the project, but I'm not really sure where to begin with this one.

Imagine a list of icons that the user can scroll through that is in an arc instead of straight vertical up and down. How in the world could I go about that?

Thanks for any ideas or points of direction to start with....

Edited by xeroTechnologiesLLC
Link to comment
Share on other sites

This is what we have come up with so far - which seems to be working for the most part....if the user scrolls slowly. If you scroll real fast the button disappears. any thoughts how to prevent this?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MouseOnEvent.au3>
$Form1 = GUICreate("Form1", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
$btnMove = GUICtrlCreateButton("Scroll up or down", 288, @DesktopHeight - 50, 75, 25)
GUISetState(@SW_SHOW)
_MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "scroll_up")
_MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "scroll_down")

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd
; $a = x axis
; $b = y axis
func scroll_up()
           $btn = ControlGetPos($Form1, "", $btnMove)
            $b = $btn[1]
If $b < @DesktopHeight / 2 + 25 Then         ; + 25 for the height of the button to offset the scroller so it doesn't move everything left
            For $a = $btn[0] + 1 To $btn[0] + 21       ; no step means it will go to the right
    $b -= 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then        ; adjust the $a, # to adjust the speed at which the button moves
       Sleep(1)
    EndIf
            Next

ElseIf $b > @DesktopHeight / 2  Then
            For $a = $btn[0] - 1 To $btn[0] - 21 Step - 1
    $b -= 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
EndIf
EndFunc
func scroll_down()
            $btn = ControlGetPos($Form1, "", $btnMove)
            $b = $btn[1]
If $b < @DesktopHeight / 2 Then
   For $a = $btn[0] - 1 To $btn[0] - 21 Step - 1
    $b += 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
ElseIf $b > @DesktopHeight / 2 Then
            For $a = $btn[0] + 1 To $btn[0] + 21 Step + 1
    $b += 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
EndIf
EndFunc
Link to comment
Share on other sites

Unfortunately, when adding a second control - it gets a little stupid.

Back to the drawing board...

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MouseOnEvent.au3>
$Form1 = GUICreate("Form1", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
$btnMove = GUICtrlCreateButton("1", 288, @DesktopHeight - 50, 75, 25)
$btnMove1 = GUICtrlCreateButton("2", 363, @DesktopHeight - 15, 75, 25)
GUISetState(@SW_SHOW)
_MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "scroll_up")
_MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "scroll_down")

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd
; $a = x axis
; $b = y axis
func scroll_up()
   $btn = ControlGetPos($Form1, "", $btnMove)
    $b = $btn[1]
    $btn1 = ControlGetPos($Form1, "", $btnMove1)
    $b1 = $btn1[1]
If $b < @DesktopHeight / 2 + 25 Then         ; + 25 for the height of the button to offset the scroller so it doesn't move everything left
            For $a = $btn[0] + 1 To $btn[0] + 21       ; no step means it will go to the right
    $b -= 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then        ; adjust the $a, # to adjust the speed at which the button moves
       Sleep(1)
    EndIf
            Next

ElseIf $b > @DesktopHeight / 2  Then
            For $a = $btn[0] - 1 To $btn[0] - 21 Step - 1
    $b -= 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
EndIf

If $b1 < @DesktopHeight / 2 + 25 Then        ; + 25 for the height of the button to offset the scroller so it doesn't move everything left
            For $a1 = $btn1[0] + 1 To $btn1[0] + 21    ; no step means it will go to the right
    $b1 -= 3
    ControlMove($Form1, "", $btnMove1, $a1, $b1)
    If Mod($a1, 2) = 0 Then       ; adjust the $a, # to adjust the speed at which the button moves
       Sleep(1)
    EndIf
            Next

ElseIf $b1 > @DesktopHeight / 2  Then
            For $a1 = $btn1[0] - 1 To $btn1[0] - 21 Step - 1
    $b1 -= 3
    ControlMove($Form1, "", $btnMove1, $a1, $b1)
    If Mod($a1, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
EndIf
EndFunc
func scroll_down()
   $btn = ControlGetPos($Form1, "", $btnMove)
    $b = $btn[1]
   $btn1 = ControlGetPos($Form1, "", $btnMove1)
    $b1 = $btn1[1]
If $b < @DesktopHeight / 2 Then
   For $a = $btn[0] - 1 To $btn[0] - 21 Step - 1
    $b += 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
ElseIf $b > @DesktopHeight / 2 Then
            For $a = $btn[0] + 1 To $btn[0] + 21 Step + 1
    $b += 3
    ControlMove($Form1, "", $btnMove, $a, $b)
    If Mod($a, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
EndIf
If $b1 < @DesktopHeight / 2 Then
   For $a1 = $btn1[0] - 1 To $btn1[0] - 21 Step - 1
    $b1 += 3
    ControlMove($Form1, "", $btnMove1, $a1, $b1)
    If Mod($a1, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
ElseIf $b1 > @DesktopHeight / 2 Then
            For $a1 = $btn1[0] + 1 To $btn1[0] + 21 Step + 1
    $b1 += 3
    ControlMove($Form1, "", $btnMove1, $a1, $b1)
    If Mod($a1, 2) = 0 Then
       Sleep(1)
    EndIf
            Next
EndIf
EndFunc
Link to comment
Share on other sites

The more and more I research this concept will not be doable in AutoIT. Mainly because I need it to scroll in a wheel and 3/4 of it will be hidden from the users view. I am not seeing any easy way to do this.

If anyone has any thoughts, please let me know.

So far we are aiming to take this project to a new coding platform. .net or flash depending on relevant capabilities.

Link to comment
Share on other sites

So I found this:

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
_Main()
Func _Main()
    Local $hGUI, $hGraphic
    ; Create GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState()
    ; Draw arcs
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    _GDIPlus_GraphicsDrawArc($hGraphic, 160, 100, 10, 10, 180, 360)
    _GDIPlus_GraphicsDrawArc($hGraphic, 180, 100, 10, 10, 180, 360)
    _GDIPlus_GraphicsDrawArc($hGraphic, 160, 104, 30, 30, 160, -140)
    _GDIPlus_GraphicsDrawArc($hGraphic, 140, 80, 70, 70, 180, 360)
    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    ; Clean up resources
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>_Main

Which will draw a perfect arc.

So, that's cool. How can I use that to help me move a control along said arc? LOL

Controlmove moves to a singular x,y coordinate at a time. So I guess I could loop it, but it would be jumpy movement.

Anyone have any thoughts?

Link to comment
Share on other sites

So glad I found UEZ's samples on rotating and such.

Attached is some code that will, hopefully, help others that are trying to build themselves a scrolling menu or something of the nature.

The rest is up to however you want to make it, but this was probably the hardest part for me personally.

UEZ - not enough thanks make weight of how appreciative I am of you posting those examples.

This requires the Mouse On Event scrolling UDF...which I think this is the correct link: .

Hope this helps anyone else.

If y'all have ideas how to improve it, please fire away.

;coded by UEZ 2009
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
;~ #AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%" ;very slow
#AutoIt3Wrapper_Run_After=del "Rotating Letters Transparent_Obfuscated.au3"
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <String.au3>
#include <MouseOnEvent.au3>
Global $Mpos = MouseGetPos()
HotKeySet("^{UP}", "showTheGUI")
HotKeySet("^{DOWN}", "hideTheGUI")
Global Const $width = @DesktopWidth
Global Const $height = @DesktopHeight
Global Const $pi_div_180 = 4 * ATan(1) / 180
Global $graphics, $backbuffer, $bitmap, $Pen, $arrTxt1, $arrTxt2, $fontsize_txt1, $fontsize_txt2
Global $brush_color, $hFamily1, $hFamily2, $hFont1, $hFont2, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $x1, $x2, $y1, $y2, $a, $b, $c, $r, $g, $b
Global $i = 0, $j = 360, $m = 0, $n = 0
Global $radius_x, $radius_y
Global $title = "GDI+: Rotating Letters by UEZ 2009!"
Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo"
;Register callback
$hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")
$hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
$hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0)
Opt("GUIOnEventMode", 1)
$hwnd = GUICreate($title, $width, $height, $Mpos[0], $Mpos[1], 0, $WS_EX_LAYERED + $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2)
$ScreenDc = _WinAPI_GetDC($hWnd)
$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)
_WinAPI_SelectObject($dc, $gdibitmap)
; _WinAPI_UpdateLayeredWindow parameters
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $width)
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
Global $alpha = 200
Global $alpha_steps = 5
DllStructSetData($tBlend, "Alpha", $alpha)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)
GUISetState(@SW_HIDE, $hwnd)
_MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "scroll_up")
_MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "scroll_down")
$fontsize_txt1 = 24
$width_mul_045 = $width * 0.45
$height_mul_045 = $height * 0.45
$radius_x1 = ($width_mul_045) * 0.95
$radius_y1 = ($height_mul_045) * 0.95
$text1 = "Item 1,Item 2,Item 3,Item 4,Item 5,Item 6,Item 7,Item 8,Item 9,Item 10"
$arrTxt1 = StringSplit($text1, ",")
Dim $arrX1[UBound($arrTxt1)]
Dim $arrY1[UBound($arrTxt1)]
Dim $brush1[UBound($arrTxt1)]

$r = 1
$c = (255 / UBound($arrTxt1) - 1) * 2 - 1
$r = 0x80
$g = 0xA0
$b = $c
For $k = 0 To UBound($arrTxt1) - 1
$brush_color = "0xff00ff00"  ; will change the font color - old:"0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
$brush1[$k] = _GDIPlus_BrushCreateSolid($brush_color)
If $r = 1 Then
  $b += $c
Else
  $b -= $c
EndIf
If $b >= 255 Then $r = 0
If $b <= $c Then $r = 1
Next
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily1 = _GDIPlus_FontFamilyCreate("Arial")
$hFont1 = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 2)
$tLayout = _GDIPlus_RectFCreate(0, 0)
$a = 360 / (UBound($arrTxt1) - 1)
$y = 0
Do
_GDIPlus_GraphicsClear($backbuffer, 0x00000000)
For $x = 1 To UBound($arrTxt1) - 1
  $x1 = $width_mul_045 + Cos(($i + $m) * $pi_div_180) * $radius_x1
  $y1 = $height_mul_045 + Sin(($i + $m) * $pi_div_180) * $radius_y1 - $fontsize_txt1 / 10
  $arrX1[$x] = $x1
  $arrY1[$x] = $y1
  DllStructSetData($tLayout, "x", $arrX1[$x])
  DllStructSetData($tLayout, "y", $arrY1[$x])
  _GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt1[$x], $hFont1, $tLayout, $hFormat, $brush1[$x])
  $m += $a
Next
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
_WinAPI_DeleteObject($gdibitmap)
Until False * Not Sleep(30)

Func Array_Rot(ByRef $arr, $dir = 0) ;0 for left, 1 for right
Local $tmp, $p,$q
If $dir = 0 Then ;left rotation
  $tmp = $arr[0]
  $q = 0
  For $p = 1 To UBound($arr) - 1
   $arr[$q] = $arr[$p]
   $q += 1
  Next
  $arr[UBound($arr) - 1] = $tmp
ElseIf $dir = 1 Then ;right rotation
  $tmp = $arr[UBound($arr) - 1]
  $q = UBound($arr) - 1
  For $p = UBound($arr) - 2 To 0 Step - 1
   $arr[$q] = $arr[$p]
   $q -= 1
  Next
  $arr[0] = $tmp
EndIf
EndFunc
;http://www.autoitscript.com/forum/index.php?showtopic=81761
Func _Mouse_Proc($nCode, $wParam, $lParam) ;function called for mouse events.. Made by _Kurt
;define local vars
Local $info, $mouseData
If $nCode < 0 Then ;recommended, see http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx
  $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam) ;recommended
  Return $ret[0]
EndIf
$info = DllStructCreate($MSLLHOOKSTRUCT, $lParam)
$mouseData = DllStructGetData($info, 3)
;Find which event happened
Select
  Case $wParam = $WM_MOUSEWHEEL And WinActive($hwnd)
   If _WinAPI_HiWord($mouseData) > 0 Then ;wheel up
    If $alpha + $alpha_steps <= 512 Then $alpha += $alpha_steps
    Switch $alpha
     Case 0 To 255
      DllStructSetData($tBlend, "Alpha", $alpha)
      DllStructSetData($tBlend, "Format", 1)
     Case 256 To 512
      DllStructSetData($tBlend, "Alpha", $alpha - 256)
      DllStructSetData($tBlend, "Format", 0)
    EndSwitch
   Else ;wheel down
    If $alpha - $alpha_steps > 0 Then $alpha -= $alpha_steps
    Switch $alpha
     Case 0 To 255
      DllStructSetData($tBlend, "Alpha", $alpha) ;wheel up
      DllStructSetData($tBlend, "Format", 1)
     Case 256 To 512
      DllStructSetData($tBlend, "Alpha", $alpha - 256) ;wheel up
      DllStructSetData($tBlend, "Format", 0)
    EndSwitch
   EndIf
   ConsoleWrite($alpha & @CRLF)
EndSelect
;This is recommended instead of Return 0
$ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam)
Return $ret[0]
EndFunc   ;==>_Mouse_Proc
Func Close()
DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
$hM_Hook[0] = 0
DllCallbackFree($hKey_Proc)
$hKey_Proc = 0
For $x = 0 To UBound($arrTxt1) - 1
  _GDIPlus_BrushDispose($brush1[$x])
Next
For $x = 0 To UBound($arrTxt2) - 1
  _GDIPlus_BrushDispose($brush2[$x])
Next
_WinAPI_DeleteDC($dc)
    _WinAPI_ReleaseDC($hWnd, $ScreenDc)
_GDIPlus_FontDispose($hFont1)
_GDIPlus_FontDispose($hFont2)
_GDIPlus_FontFamilyDispose($hFamily1)
_GDIPlus_FontFamilyDispose($hFamily2)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
WinClose($hwnd)
Exit
EndFunc

func scroll_up()
$i = $i + 5
EndFunc

Func scroll_down()
$i = $i - 5
EndFunc
func showTheGUI()
   ; if it's already visible - don't rerun the function - otherwise, make it visible
    $s = ""
    $style = ""
    $Mpos = MouseGetPos()
   $style = GUIGetStyle($hwnd)
    $s = BitAND($style[0], $WS_VISIBLE)
    If $s = 0 Then
          $Mpos = MouseGetPos()
          WinMove($hwnd, "", $Mpos[0] - (@DesktopWidth/2), $Mpos[1] - (@DesktopHeight/2))
          GUISetState(@SW_SHOW, $hwnd)
      Elseif $s <> 0 Then
;~       hideTheGUI() - helps with if the user spams ctrl up
        $Mpos = MouseGetPos()
          WinMove($hwnd, "", $Mpos[0] - (@DesktopWidth/2), $Mpos[1] - (@DesktopHeight/2))
          GUISetState(@SW_SHOW, $hwnd)
    EndIf
EndFunc
func hideTheGUI()
      GUISetState(@SW_HIDE, $hwnd)
EndFunc
;==>Close

edit: added the link to UEZ's post.

Edited by xeroTechnologiesLLC
Link to comment
Share on other sites

Cleaned up the code and removed unneeded (for this project) code.

Now the problem I am having is moving the visible area to the right side instead of just the left.

Overall code:

;coded by UEZ 2009
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
;~ #AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%" ;very slow
#AutoIt3Wrapper_Run_After=del "Rotating Letters Transparent_Obfuscated.au3"
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <String.au3>
#include <MouseOnEvent.au3>
Global $Mpos = MouseGetPos()
HotKeySet("^{UP}", "showTheGUI")
HotKeySet("^{DOWN}", "hideTheGUI")
Global Const $width = 500
Global Const $height = @DesktopHeight
Global Const $pi_div_180 = 4 * ATan(1) / 180
Global $graphics, $backbuffer, $bitmap, $Pen, $arrTxt1, $arrTxt2, $fontsize_txt1, $fontsize_txt2
Global $brush_color, $hFamily1, $hFamily2, $hFont1, $hFont2, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $x1, $x2, $y1, $y2, $a, $b, $c, $r, $g, $b
Global $i = 0, $j = 360, $m = 0, $n = 0
Global $radius_x, $radius_y
Global $title = "GDI+: Rotating Letters by UEZ 2009!"
Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo"
;Register callback
$hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")
$hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
$hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0)
Opt("GUIOnEventMode", 1)
$hwnd = GUICreate($title, 1200, $height, $Mpos[0], $Mpos[1], 0, $WS_EX_LAYERED + $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 0)
$ScreenDc = _WinAPI_GetDC($hWnd)
$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)
_WinAPI_SelectObject($dc, $gdibitmap)
; _WinAPI_UpdateLayeredWindow parameters
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", 300)  ; adjust to show what is visible
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
Global $alpha = 200
Global $alpha_steps = 5
DllStructSetData($tBlend, "Alpha", $alpha)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)
GUISetState(@SW_HIDE, $hwnd)
;scroll functions
_MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "scroll_up")
_MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "scroll_down")
; set the font size of the visible text
$fontsize_txt1 = 24
$width_mul_045 = $width * 0.45
$height_mul_045 = $height * 0.45
$radius_x1 = ($width_mul_045) * 0.95
$radius_y1 = ($height_mul_045) * 0.95
$text1 = "Item 1,Item 2,Item 3,Item 4,Item 5,Item 6,Item 7,Item 8,Item 9,Item 10"  ; list of items in the circle
$arrTxt1 = StringSplit($text1, ",")
Dim $arrX1[UBound($arrTxt1)]
Dim $arrY1[UBound($arrTxt1)]
Dim $brush1[UBound($arrTxt1)]

$r = 1
$c = (255 / UBound($arrTxt1) - 1) * 2 - 1
$r = 0x80
$g = 0xA0
$b = $c
For $k = 0 To UBound($arrTxt1) - 1
$brush_color = "0xff00ff00"  ; will change the font color - old:"0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
$brush1[$k] = _GDIPlus_BrushCreateSolid($brush_color)
If $r = 1 Then
  $b += $c
Else
  $b -= $c
EndIf
If $b >= 255 Then $r = 0
If $b <= $c Then $r = 1
Next
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily1 = _GDIPlus_FontFamilyCreate("Arial")
$hFont1 = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 2)
$tLayout = _GDIPlus_RectFCreate(0, 0)
$a = 360 / (UBound($arrTxt1) - 1)
$y = 0
Do
_GDIPlus_GraphicsClear($backbuffer, 0x00000000)
For $x = 1 To UBound($arrTxt1) - 1
  $x1 = $width_mul_045 + Cos(($i + $m) * $pi_div_180) * $radius_x1
  $y1 = $height_mul_045 + Sin(($i + $m) * $pi_div_180) * $radius_y1 - $fontsize_txt1 / 10
  $arrX1[$x] = $x1
  $arrY1[$x] = $y1
  DllStructSetData($tLayout, "x", $arrX1[$x])
  DllStructSetData($tLayout, "y", $arrY1[$x])
  _GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt1[$x], $hFont1, $tLayout, $hFormat, $brush1[$x])
  $m += $a
Next
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
_WinAPI_DeleteObject($gdibitmap)
Until False * Not Sleep(30)

Func Close()
DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
$hM_Hook[0] = 0
DllCallbackFree($hKey_Proc)
$hKey_Proc = 0
For $x = 0 To UBound($arrTxt1) - 1
  _GDIPlus_BrushDispose($brush1[$x])
Next
_WinAPI_DeleteDC($dc)
    _WinAPI_ReleaseDC($hWnd, $ScreenDc)
_GDIPlus_FontDispose($hFont1)
_GDIPlus_FontFamilyDispose($hFamily1)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
WinClose($hwnd)
Exit
EndFunc

func scroll_up()
$i = $i + 5
EndFunc

Func scroll_down()
$i = $i - 5
EndFunc
func showTheGUI()
   ; if it's already visible - don't rerun the function - otherwise, make it visible
    $s = ""
    $style = ""
    $Mpos = MouseGetPos()
   $style = GUIGetStyle($hwnd)
    $s = BitAND($style[0], $WS_VISIBLE)
    If $s = 0 Then
          $Mpos = MouseGetPos()
          WinMove($hwnd, "", $Mpos[0] - ($width/2), $Mpos[1] - ($height/2))
          GUISetState(@SW_SHOW, $hwnd)
      Elseif $s <> 0 Then
;~       hideTheGUI() - helps with if the user spams ctrl up
        $Mpos = MouseGetPos()
          WinMove($hwnd, "", $Mpos[0] - ($width/2), $Mpos[1] - ($height/2))
          GUISetState(@SW_SHOW, $hwnd)
    EndIf
EndFunc
func hideTheGUI()
      GUISetState(@SW_HIDE, $hwnd)
EndFunc
;==>Close

I thought that this section would basically say - what area is visible (in the first $tSize = dllstructCreate command) then where the 'visible box area' is with the last $tpoint = dllstructCreate command:

; _WinAPI_UpdateLayeredWindow parameters
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", 300)  ; adjust to show what is visible
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
Global $alpha = 200
Global $alpha_steps = 5
DllStructSetData($tBlend, "Alpha", $alpha)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)

Am I misunderstanding the purpose of this block of code?

Link to comment
Share on other sites

Arg, so stupid.

$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)

...didn't have any values to tell it where to show up.

So to make the right side of the circle visible instead of the left we have:

Global Const $width = 1024

...initial width of the total window

; adjust to show what side is visible
; 0 0 - left side ...  600 0 right side
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
DllStructSetData($tSource, "X", 600)
DllStructSetData($tSource, "Y", 0)

if you want just the left side visible, change the X value to 0.

The width of the window will help you determine the value of X and you will have to play with it a bit if you adjust the overall width to find the right value amount, but... so far this methodology is working.

Thanks again to UEZ.

Link to comment
Share on other sites

holy post spamming batman!

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Apologies, I was not trying to spam post.

I had a thought on something I wanted to create, didn't see anything else of it's style on the forums and wanted to post the findings as opposed to another dead ended thread.

Again, apologies and I will hold off on the final design post and post it in the examples forum once complete.

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...