Jump to content

MetroGUI UDF v5.1 - Windows 10 style buttons, toggles, radios, menu etc.


Recommended Posts

hi

this is a nice udf

but..it will make some error for GUICtrlSlider function

after mouse to click the slider

the slider thumbmark will not display.

t think ....may be you must to write the slider function of your udf.

HA..HA..HA..

-Everything are starting by the dreams.-Everybody is working with computer.-Everydays will auto because we need it. Come on..Let's doing...AUTOIT....^^"..just a little idea..a little A.D.

Link to post
Share on other sites
  • 6 months later...
  • Replies 289
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Features: Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize, Fullscreen, Menu) True borderless, resizeable GUI with full support fo

Hi, Give you some solution for tab control from me.     FlatTab.au3 #include-once #include <GDIPlus.au3> #include <Array.au3> #include "GUI

I know I disappointed some of you guys with this version as you were waiting for the requested features like Sliders, InputBox, Support for tabbing through controls and other stuff. I spent a lot of t

Posted Images

On 10/18/2017 at 5:46 PM, NHD said:

Hi,

Give you some solution for tab control from me.

 

flat.png

 

FlatTab.au3

#include-once
#include <GDIPlus.au3>
#include <Array.au3>
#include "GUICtrlOnHover.au3"

Global $FlatUIColor = DllStructCreate("struct;float back;float fore;float frame;endstruct;")
$FlatUIColor.back = 0x3C4649
$FlatUIColor.fore = 0x23A86D ;0x3498db
$FlatUIColor.frame = 0x2D2F31

Global Const $tObjTabEx = "hwnd hwnd;byte ctrl;byte ctab;" & _
                        "byte count;byte current;int next;" & _
                        "int width;int x;int y;"
Global Const $tObjTabBtnEx = "byte ctrl;byte ctab;byte idtab;" & _
                        "wchar text[255];"
Global $____aTabList[1] = [0]
Global $____aTabBtnList[1] = [0]

Func FlatTab_Create($hWnd, $Left, $Top, $Width, $Height)
    GUISwitch($hWnd)

    Local $oObj = DllStructCreate($tObjTabEx)
    _ArrayAdd($____aTabList, $oObj)
    $____aTabList[0] += 1
    $oObj.hwnd = $hWnd

    $oObj.ctrl = GUICtrlCreatePic("", $Left, $Top+25, $Width, $Height-50)
    GUICtrlSetResizing($oObj.ctrl, 802)
    GUICtrlSetState($oObj.ctrl, 128)
    $oObj.ctab = GUICtrlCreateTab(-99, -99, 1, 1)
    GUICtrlSetState($oObj.ctab, 128)

    Local $aBmp = _GDIPlus_BitmapCreateFromScan0($Width, $Height-50)
    Local $hGfx = _GDIPlus_ImageGetGraphicsContext($aBmp)
    Local $hPen = _GDIPlus_PenCreate($FlatUIColor.frame+0xFF000000, 4)
    Local $hBrush = _GDIPlus_BrushCreateSolid($FlatUIColor.frame+0xFF000000)
    _GDIPlus_GraphicsDrawRect($hGfx, 0, 0, $Width, $Height-50, $hPen)
    _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $Width, $Height-50, $hBrush)
    _GDIPlus_GraphicsClear($hGfx, $FlatUIColor.frame+0xFF000000)
    Local $hBmp = _GDIPlus_BitmapCreateDIBFromBitmap($aBmp)
    _GDIPlus_BitmapDispose($aBmp)
    _GDIPlus_GraphicsDispose($hGfx)
    _GDIPlus_PenDispose($hPen)
    _WinAPI_DeleteObject(GUICtrlSendMsg($oObj.ctrl, 0x0172, 0, $hBmp))
    _WinAPI_DeleteObject($hBmp)

    $oObj.width = $Width
    $oObj.x = $Left
    $oObj.y = $Top
    $oObj.current = ""
    $oObj.count = 0
    $oObj.next = $Left

    Return $oObj
EndFunc

Func FlatTab_AddTab($Ctrl, $Text)
    GUISwitch($Ctrl.hwnd)
    GUICtrlCreateTabItem("")

    Local $oObj = DllStructCreate($tObjTabBtnEx)
    _ArrayAdd($____aTabBtnList, $oObj)
    $____aTabBtnList[0] += 1
    $oObj.ctrl = GUICtrlCreatePic("", $Ctrl.next, $Ctrl.y, 80, 25)
    GUICtrlSetResizing($oObj.ctrl, 802)
    _GUICtrl_OnHoverRegister($oObj.ctrl, 'FlatTab_EventHover', 'FlatTab_EventHover', 'FlatTab_EventClick', 'FlatTab_EventClick')
    $oObj.count +=1
    $oObj.idtab = GUICtrlCreateTabItem($oObj.count)
    $oObj.text = $Text

    If $Ctrl.current <> "" Then
        Local $Prev = FlatTab_GetObjTabBtnFromCtrl($Ctrl.current)
        FlatTab_Draw($Prev.ctrl, $Prev.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF000000)
    EndIf
    FlatTab_Draw($oObj.ctrl, $Text, 0xFFFFFFFF, $FlatUIColor.frame+0xFF000000)

    $Ctrl.current = $oObj.ctrl
    $oObj.ctab = $Ctrl.ctab
    $Ctrl.next += 80
    GUICtrlSetState($oObj.idtab, 16)
    Return $oObj.idtab
EndFunc

Func FlatTab_EventHover($Ctrl, $Mode)
    Local $Obj1 = FlatTab_GetObjTabFromCtrl($Ctrl)
    If $Obj1.current = $Ctrl Then Return
    Local $Obj2 = FlatTab_GetObjTabBtnFromCtrl($Ctrl)
    Switch $Mode
        Case 1
            FlatTab_Draw($Ctrl, $Obj2.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF151515)
        Case 2
            FlatTab_Draw($Ctrl, $Obj2.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF000000)
    EndSwitch
EndFunc

Func FlatTab_EventClick($Ctrl, $Mode)
    If $Mode = 2 Then
        Local $Obj1 = FlatTab_GetObjTabFromCtrl($Ctrl)
        If $Obj1.current = $Ctrl Then Return
        Local $Obj2 = FlatTab_GetObjTabBtnFromCtrl($Ctrl)
        Local $Obj3 = FlatTab_GetObjTabBtnFromCtrl($Obj1.current)
        FlatTab_Draw($Ctrl, $Obj2.text, 0xFFFFFFFF, $FlatUIColor.frame+0xFF000000)
        FlatTab_Draw($Obj3.ctrl, $Obj3.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF000000)
        GUICtrlSetState($Obj2.idtab, 16)
        $Obj1.current = $Ctrl
    EndIf
EndFunc

Func FlatTab_GetObjTabFromCtrl($Ctrl)
    Local $Obj2, $Index
    Local $Obj = FlatTab_GetObjTabBtnFromCtrl($Ctrl)

    If $____aTabList[0] = 0 Then Return False

    For $Index = $____aTabList[0] To 1 Step -1
        $Obj2 = $____aTabList[$Index]
        If $Obj2.ctab == $Obj.ctab Then Return $____aTabList[$Index]
    Next

    Return False
EndFunc

Func FlatTab_GetObjTabBtnFromCtrl($Ctrl)
    Local $Obj, $Index

    If $____aTabBtnList[0] = 0 Then Return False
    For $Index = $____aTabBtnList[0] To 1 Step -1
        $Obj = $____aTabBtnList[$Index]
        If $Obj.ctrl == $Ctrl Then Return $____aTabBtnList[$Index]
    Next

    Return False
EndFunc

Func FlatTab_Draw($iCtrl, $Text, $Color = 0xFFFFFFFF, $BgColor = 0x00FFFFFF)
    Local $hWnd = _WinAPI_GetParent(GUICtrlGetHandle($iCtrl))
    Local $aPos = ControlGetPos($hWnd, "", $iCtrl)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI Semibold")
    Local $hFont =  _GDIPlus_FontCreate($hFamily, 10, 0)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, $aPos[2], $aPos[3])
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    Local $aBitmaps = _GDIPlus_BitmapCreateFromScan0($aPos[2], $aPos[3])
    Local $aGfxCtxt = _GDIPlus_ImageGetGraphicsContext($aBitmaps)
    _GDIPlus_GraphicsSetSmoothingMode($aGfxCtxt, 2)
    _GDIPlus_GraphicsSetTextRenderingHint($aGfxCtxt, 5)
    _GDIPlus_GraphicsClear($aGfxCtxt, $BgColor)
    Local $hBrushColor = _GDIPlus_BrushCreateSolid($Color)
    _GDIPlus_GraphicsDrawStringEx($aGfxCtxt, $Text, $hFont, $tLayout, $hFormat, $hBrushColor)
    Local $aHBitmaps = _GDIPlus_BitmapCreateDIBFromBitmap($aBitmaps)
    _GDIPlus_BrushDispose($hBrushColor)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_BitmapDispose($aBitmaps)
    _GDIPlus_GraphicsDispose($aGfxCtxt)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrl, 0x0172, 0, $aHBitmaps))
    _WinAPI_DeleteObject($aHBitmaps)
EndFunc

 

FlatTab_Example.au3

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

_GDIPlus_Startup();

Global $hGUI = GUICreate("FlatTab Example", 450, 290);
GUISetBkColor(0x3C4649, $hGUI);
GUISetFont(10, 400, 0, "Segoe UI", $hGUI, 5);


Global $Tab = FlatTab_Create($hGUI, 10, 10, 430, 290);
;=================================================
FlatTab_AddTab($Tab, "Tab 1");
GUICtrlCreateLabel("This is Tab 1", 30, 50);
GUICtrlSetColor(-1, 0xFFFFFF);
GUICtrlCreateButton("Button 1", 30, 100, 75, 25);
GUICtrlCreateButton("Button 2", 120, 100, 75, 25);
;=================================================
FlatTab_AddTab($Tab, "Tab 2");
GUICtrlCreateLabel("This is Tab 2", 30, 50);
GUICtrlSetColor(-1, 0xFFFFFF);
GUICtrlCreateButton("Button 3", 210, 100, 75, 25);
GUICtrlCreateButton("Button 4", 30, 150, 75, 25);
;=================================================
FlatTab_AddTab($Tab, "Tab 3");
GUICtrlCreateLabel("This is Tab 3", 30, 50);
GUICtrlSetColor(-1, 0xFFFFFF);
GUICtrlCreateButton("Button 5", 120, 150, 75, 25);
GUICtrlCreateButton("Button 6", 210, 150, 75, 25);
;=================================================
GUICtrlCreateTabItem("");

GUISetState();

Do
    Sleep(10);
Until GUIGetMsg() = -3;

 

 

 

Hi

i use GUIFlatButton in this Sample

GUIFlatButton not show correct

 

1- shown when mouse hovered on it

2- it shown on other tabs 

How to fix this problem

i have this problem with other GDI+ forms 

 

 

Check-Problem.zip

Link to post
Share on other sites
  • 2 months later...
On 10/18/2017 at 5:46 PM, NHD said:

Hi,

Give you some solution for tab control from me.

 

flat.png

 

FlatTab.au3

#include-once
#include <GDIPlus.au3>
#include <Array.au3>
#include "GUICtrlOnHover.au3"

Global $FlatUIColor = DllStructCreate("struct;float back;float fore;float frame;endstruct;")
$FlatUIColor.back = 0x3C4649
$FlatUIColor.fore = 0x23A86D ;0x3498db
$FlatUIColor.frame = 0x2D2F31

Global Const $tObjTabEx = "hwnd hwnd;byte ctrl;byte ctab;" & _
                        "byte count;byte current;int next;" & _
                        "int width;int x;int y;"
Global Const $tObjTabBtnEx = "byte ctrl;byte ctab;byte idtab;" & _
                        "wchar text[255];"
Global $____aTabList[1] = [0]
Global $____aTabBtnList[1] = [0]

Func FlatTab_Create($hWnd, $Left, $Top, $Width, $Height)
    GUISwitch($hWnd)

    Local $oObj = DllStructCreate($tObjTabEx)
    _ArrayAdd($____aTabList, $oObj)
    $____aTabList[0] += 1
    $oObj.hwnd = $hWnd

    $oObj.ctrl = GUICtrlCreatePic("", $Left, $Top+25, $Width, $Height-50)
    GUICtrlSetResizing($oObj.ctrl, 802)
    GUICtrlSetState($oObj.ctrl, 128)
    $oObj.ctab = GUICtrlCreateTab(-99, -99, 1, 1)
    GUICtrlSetState($oObj.ctab, 128)

    Local $aBmp = _GDIPlus_BitmapCreateFromScan0($Width, $Height-50)
    Local $hGfx = _GDIPlus_ImageGetGraphicsContext($aBmp)
    Local $hPen = _GDIPlus_PenCreate($FlatUIColor.frame+0xFF000000, 4)
    Local $hBrush = _GDIPlus_BrushCreateSolid($FlatUIColor.frame+0xFF000000)
    _GDIPlus_GraphicsDrawRect($hGfx, 0, 0, $Width, $Height-50, $hPen)
    _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $Width, $Height-50, $hBrush)
    _GDIPlus_GraphicsClear($hGfx, $FlatUIColor.frame+0xFF000000)
    Local $hBmp = _GDIPlus_BitmapCreateDIBFromBitmap($aBmp)
    _GDIPlus_BitmapDispose($aBmp)
    _GDIPlus_GraphicsDispose($hGfx)
    _GDIPlus_PenDispose($hPen)
    _WinAPI_DeleteObject(GUICtrlSendMsg($oObj.ctrl, 0x0172, 0, $hBmp))
    _WinAPI_DeleteObject($hBmp)

    $oObj.width = $Width
    $oObj.x = $Left
    $oObj.y = $Top
    $oObj.current = ""
    $oObj.count = 0
    $oObj.next = $Left

    Return $oObj
EndFunc

Func FlatTab_AddTab($Ctrl, $Text)
    GUISwitch($Ctrl.hwnd)
    GUICtrlCreateTabItem("")

    Local $oObj = DllStructCreate($tObjTabBtnEx)
    _ArrayAdd($____aTabBtnList, $oObj)
    $____aTabBtnList[0] += 1
    $oObj.ctrl = GUICtrlCreatePic("", $Ctrl.next, $Ctrl.y, 80, 25)
    GUICtrlSetResizing($oObj.ctrl, 802)
    _GUICtrl_OnHoverRegister($oObj.ctrl, 'FlatTab_EventHover', 'FlatTab_EventHover', 'FlatTab_EventClick', 'FlatTab_EventClick')
    $oObj.count +=1
    $oObj.idtab = GUICtrlCreateTabItem($oObj.count)
    $oObj.text = $Text

    If $Ctrl.current <> "" Then
        Local $Prev = FlatTab_GetObjTabBtnFromCtrl($Ctrl.current)
        FlatTab_Draw($Prev.ctrl, $Prev.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF000000)
    EndIf
    FlatTab_Draw($oObj.ctrl, $Text, 0xFFFFFFFF, $FlatUIColor.frame+0xFF000000)

    $Ctrl.current = $oObj.ctrl
    $oObj.ctab = $Ctrl.ctab
    $Ctrl.next += 80
    GUICtrlSetState($oObj.idtab, 16)
    Return $oObj.idtab
EndFunc

Func FlatTab_EventHover($Ctrl, $Mode)
    Local $Obj1 = FlatTab_GetObjTabFromCtrl($Ctrl)
    If $Obj1.current = $Ctrl Then Return
    Local $Obj2 = FlatTab_GetObjTabBtnFromCtrl($Ctrl)
    Switch $Mode
        Case 1
            FlatTab_Draw($Ctrl, $Obj2.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF151515)
        Case 2
            FlatTab_Draw($Ctrl, $Obj2.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF000000)
    EndSwitch
EndFunc

Func FlatTab_EventClick($Ctrl, $Mode)
    If $Mode = 2 Then
        Local $Obj1 = FlatTab_GetObjTabFromCtrl($Ctrl)
        If $Obj1.current = $Ctrl Then Return
        Local $Obj2 = FlatTab_GetObjTabBtnFromCtrl($Ctrl)
        Local $Obj3 = FlatTab_GetObjTabBtnFromCtrl($Obj1.current)
        FlatTab_Draw($Ctrl, $Obj2.text, 0xFFFFFFFF, $FlatUIColor.frame+0xFF000000)
        FlatTab_Draw($Obj3.ctrl, $Obj3.text, 0xFFFFFFFF, $FlatUIColor.fore+0xFF000000)
        GUICtrlSetState($Obj2.idtab, 16)
        $Obj1.current = $Ctrl
    EndIf
EndFunc

Func FlatTab_GetObjTabFromCtrl($Ctrl)
    Local $Obj2, $Index
    Local $Obj = FlatTab_GetObjTabBtnFromCtrl($Ctrl)

    If $____aTabList[0] = 0 Then Return False

    For $Index = $____aTabList[0] To 1 Step -1
        $Obj2 = $____aTabList[$Index]
        If $Obj2.ctab == $Obj.ctab Then Return $____aTabList[$Index]
    Next

    Return False
EndFunc

Func FlatTab_GetObjTabBtnFromCtrl($Ctrl)
    Local $Obj, $Index

    If $____aTabBtnList[0] = 0 Then Return False
    For $Index = $____aTabBtnList[0] To 1 Step -1
        $Obj = $____aTabBtnList[$Index]
        If $Obj.ctrl == $Ctrl Then Return $____aTabBtnList[$Index]
    Next

    Return False
EndFunc

Func FlatTab_Draw($iCtrl, $Text, $Color = 0xFFFFFFFF, $BgColor = 0x00FFFFFF)
    Local $hWnd = _WinAPI_GetParent(GUICtrlGetHandle($iCtrl))
    Local $aPos = ControlGetPos($hWnd, "", $iCtrl)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI Semibold")
    Local $hFont =  _GDIPlus_FontCreate($hFamily, 10, 0)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, $aPos[2], $aPos[3])
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    Local $aBitmaps = _GDIPlus_BitmapCreateFromScan0($aPos[2], $aPos[3])
    Local $aGfxCtxt = _GDIPlus_ImageGetGraphicsContext($aBitmaps)
    _GDIPlus_GraphicsSetSmoothingMode($aGfxCtxt, 2)
    _GDIPlus_GraphicsSetTextRenderingHint($aGfxCtxt, 5)
    _GDIPlus_GraphicsClear($aGfxCtxt, $BgColor)
    Local $hBrushColor = _GDIPlus_BrushCreateSolid($Color)
    _GDIPlus_GraphicsDrawStringEx($aGfxCtxt, $Text, $hFont, $tLayout, $hFormat, $hBrushColor)
    Local $aHBitmaps = _GDIPlus_BitmapCreateDIBFromBitmap($aBitmaps)
    _GDIPlus_BrushDispose($hBrushColor)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_BitmapDispose($aBitmaps)
    _GDIPlus_GraphicsDispose($aGfxCtxt)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrl, 0x0172, 0, $aHBitmaps))
    _WinAPI_DeleteObject($aHBitmaps)
EndFunc

 

FlatTab_Example.au3

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

_GDIPlus_Startup();

Global $hGUI = GUICreate("FlatTab Example", 450, 290);
GUISetBkColor(0x3C4649, $hGUI);
GUISetFont(10, 400, 0, "Segoe UI", $hGUI, 5);


Global $Tab = FlatTab_Create($hGUI, 10, 10, 430, 290);
;=================================================
FlatTab_AddTab($Tab, "Tab 1");
GUICtrlCreateLabel("This is Tab 1", 30, 50);
GUICtrlSetColor(-1, 0xFFFFFF);
GUICtrlCreateButton("Button 1", 30, 100, 75, 25);
GUICtrlCreateButton("Button 2", 120, 100, 75, 25);
;=================================================
FlatTab_AddTab($Tab, "Tab 2");
GUICtrlCreateLabel("This is Tab 2", 30, 50);
GUICtrlSetColor(-1, 0xFFFFFF);
GUICtrlCreateButton("Button 3", 210, 100, 75, 25);
GUICtrlCreateButton("Button 4", 30, 150, 75, 25);
;=================================================
FlatTab_AddTab($Tab, "Tab 3");
GUICtrlCreateLabel("This is Tab 3", 30, 50);
GUICtrlSetColor(-1, 0xFFFFFF);
GUICtrlCreateButton("Button 5", 120, 150, 75, 25);
GUICtrlCreateButton("Button 6", 210, 150, 75, 25);
;=================================================
GUICtrlCreateTabItem("");

GUISetState();

Do
    Sleep(10);
Until GUIGetMsg() = -3;

 

 

 

how to set as default tab? 

Can anyone help?

Edited by Parsix
Link to post
Share on other sites
  • 3 months later...
  • Moderators

TesrerMachine,

Are you running a very old version of AutoIt?   Because a long time ago $__g_hGDIPDll replaced $ghGDIPDll in the GDI libraries and it looks as if you might still be using the old versions.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to post
Share on other sites
2 minutes ago, Melba23 said:

TesrerMachine,

Are you running a very old version of AutoIt?   Because a long time ago $__g_hGDIPDll replaced $ghGDIPDll in the GDI libraries and it looks as if you might still be using the old versions.

M23

sorry I'm a bit new to AutoIT and well... checking AutoUpdateIt marks version 3.3.10.1

I will update to another more recent version, thanks Melba23

Link to post
Share on other sites
  • 2 months later...

I try to add a group under control, but event are no longer working.

Controls events outside group are working perfectly but not inside.

Is it possible when gdi control over gdi graphic (only) to make events working ?

image.png.f05eb82bbb6bc599cd2a0bf93f363bc2.png  

Edited by kaz
Link to post
Share on other sites
  • 4 weeks later...
On 8/10/2022 at 12:13 AM, kaz said:

I try to add a group under control, but event are no longer working.

Controls events outside group are working perfectly but not inside.

Is it possible when gdi control over gdi graphic (only) to make events working ?

image.png.f05eb82bbb6bc599cd2a0bf93f363bc2.png  

How do you draw such group? I mean why is it looks so nice, with background color, rounded corners, outline, etc..?

Link to post
Share on other sites
On 9/3/2022 at 2:21 PM, pat4005 said:

How do you draw such group? I mean why is it looks so nice, with background color, rounded corners, outline, etc..?

Hello, and Sory for the delay.

I changed a litle bit the original metro_gui udf, with starting a new theme and this function

 

Func _CreateGroup($Text, $Left, $Top, $Width, $Height)

    Local $Group_Array[4]


    $Group_Array[1] = False ; Set hover OFF
    $Group_Array[2] = "0" ; Type
;~  $Group_Array[15] = GetCurrentGUI()

    $Group_Color = "0xFF" & Hex($Group_Color, 6)


    $rayon = 20
    $diam = $rayon * 2

    Local $Brush_group = _GDIPlus_BrushCreateSolid($Group_Color)
    Local $hDrawPen  = _GDIPlus_PenCreate(StringReplace($hDrawPen_Color, "0x", "0xFF"), 1 ) ; taille pen contour mouse out

    local $Group_Graphic = _iGraphicCreate($Width, $Height, StringReplace($GUIThemeColor, "0x", "0xFF"), 5, 5 )


    ;Default hover state
    Local $hPath1 = _GDIPlus_PathCreate()

    _GDIPlus_PathAddArc($hPath1, $Width - $diam - 1, 0, $diam, $diam, 270, 90)
    _GDIPlus_PathAddArc($hPath1, $Width - $diam - 1, $Height - $diam - 1, $diam, $diam, 0, 90)
    _GDIPlus_PathAddArc($hPath1, 0, $Height - $diam - 1, $diam  , $diam  , 90, 90)
    _GDIPlus_PathAddArc($hPath1, 0, 0 , $diam,  $diam, 180, 90)

    _GDIPlus_PathCloseFigure($hPath1)
    _GDIPlus_GraphicsFillPath($Group_Graphic[0], $hPath1, $Brush_group)
    _GDIPlus_GraphicsDrawPath($Group_Graphic[0], $hPath1, $hDrawPen)


    _GDIPlus_BrushDispose($Brush_group)
    _GDIPlus_PenDispose($hDrawPen)
    _GDIPlus_PathDispose($hPath1)

    ;Set graphic and return Bitmap handle
    $Group_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height)
    $Group_Array[3] = _iGraphicCreateBitmapHandle($Group_Array[0], $Group_Graphic)

    ;Set GUI Resizing
    GUICtrlSetResizing($Group_Array[0], 768)

    Return $Group_Array[0]

EndFunc
Case "LightGray"
            $GUIThemeColor = "0xEAEAEA"
            $FontThemeColor = "0x000000"
            $ButtonTextColor = "0x000000"

            $ActiveColor = "0xFFFFFF"
            $InactiveColor = "0xE0E0E0"
            $hDrawPen_Color = "0xBDBDBD"


            $GUIBorderColor = "0xD8D8D8"
            $ButtonBKColor = "0xE0E0E0"

            $Group_Color  = "0xF6F6F6"


            $CB_Radio_Color = "0xFFFFFF"
            $CB_Radio_Hover_Color = "0xE8E8E8"
            $CB_Radio_CheckMark_Color = "0xffff"

I tried to obtain something near macOS style...

Link to post
Share on other sites

First of all, thank you for your help.... I removed the maximize button, but the window will be maximized in full screen at once. Can you do this without full screen:

Quote

$Control_Buttons = _Metro_AddControlButtons(True, False, True, False, False)

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By WilliamasKumeliukas
      Hello everyone,
      I started this project alone in May 2020 as project in my spare time at work, I'm working for a IT company that started opening their services to residential customers few months ago and now my position in the company kind of drifted in the doom and gloom world of repetitive tasks like: Reinstallation + Configuration of Windows 10.
      The procedure is very repetitive and I started feeling like being a robot which is the main reason I started this project.
       
       
      ==============================FAQ==================================
      1. Q: Do you want this project to be accomplished with the usage of AutoIt ONLY or 3rd party tools / Scripts (BATCH / POWERSHELL / VB) ? A: No, if I cannot find a way using AutoIt to accomplish a task I will move to my Plan B which consist of automating an 3rd party tool to accomplish the affected task until a solution is found. 2. Q: What do I get from helping/collaborating in this project? A: I will personally take the responsibility to mention you in the credits of this project. 3. Q: If I have more questions, can I ask? A: Certainly! feel free to ask any questions related to this project! 4. Q: What is the main goal of this project? A: Automating Windows 10 configuration without user interaction needed (as much as possible) ______________________________________________________________________________________________________________________________
      Current progression of the project (more will be added in future)
      « Blue = Info || Yellow = Unfinished/Untested || Purple = Could be better || Green = Done ||Red = Not Yet Started »
      ***Very early Stage ***
      Connect Network Attached Storage(NAS) (Work but missing configuration in GUI - AutoIt only)
      Download & Install up to 600+ softwares (Tested & Working - using 3rd party tool + 50/50 Powershell/AutoIt)
       Auto prediction of Apps name of text typed inside input (Tested & Working - AutoIt Only)
      Change OEM Informations (Tested & Working -  AutoIt)
      Disable hibernation (Tested & Working - AutoIt only)
      Change Computer Name (Work but require testing - AutoIt only) 
      Show Computer Information and Smart status on GUI (Tested & Working - AutoIt Only)
      Change .pdf / .pdfxml from Edge to Adobe Reader DC (Tested & Working - using 3rd party tool)
      Change Edge to Google Chrome as Default Browser (Tested & Working - using 3rd party tool)
      Windows Updater (Seems to work but require further testing - AutoIt only)
      Install Office 365 / 2013 + Activation (To Do)
      Add L2TP VPN Configuration for Windows Built-in VPN (To Do)
      Save / Load tasks configuration profile in (.ini file) to avoid repeating same configuration twice (In progress - AutoIt Only)
      (EXPERIMENTAL) Install Apps from Microsoft Store with UIAutomation UDF made by @junkew(Work if you know what your doing)
         P.S: Installing Apps from Microsoft Store will require usage of  UIA spy tool made by @LarsJ which you can download & learn how to use it on UIA Spy Tool thread.
      ***  If this project interest you, Reply here This will greatly help me to see if you'd like this project to become real  ***
      ______________________________________________________________________________________________________________________________
      Best Regards,
      ~WilliamasKumeliukas
    • By beautifulsoup
      Hi All,
      I'm not sure if its possible that I'm trying to achieve, I've looked into https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/AutoIt3Wrapper.html and such resources for help, but I cant really find the answer to my question.
      So upon compiling the script in SciTE, the exe file is given a Description under file Properties>Details. I understand, that  one can enter info manually there and it can even implement the version automatically with each compilation.
       
      What I'm trying to achieve is to somehow include the "@ScriptName" in the Details>File Description Field. But as I see no variable can be taken after "#" in this case.
       
      Do You think its achievable? (Win 10)
       
      Much obliged for taking time on reading this.
       
      Kind Regards,
      Brave


    • By IndianSage
      Hi,
      I have a specific situation:
      Is it possible to run autoit script/.exe as a task which in turn is automating a desktop user interactive application on windows 10 where user will not be logged in - at best I can get user locked? 
      If so how will this work or is there any tool available to do this?
      I am trying z-cron task scheduler but it runs only some part also I tried windows 10 task schedule with option to allow task to run which is user interactive type but that too does not work.
      Looking forward to hear from you to help me out of this situation.
      Thanks,
       
    • By therks
      So I have no example code currently because I'm not sure where to even start.
      We're using the parental controls on the computer and the kids each have their own user profiles with limited time. The problem we're encountering is when their time runs out, or if they just hit Win+L and leave the computer, their games are still running in the background. I was hoping to write up a quick AutoIt script and throw it in a recurring scheduled task to just sign off any of the kid's profiles that's not currently active. I found some suggestions to use "query session" and then "logoff [user]" in the command line (which it seems I could easily automate with AutoIt) but that's only available on Win Pro and this system is running Home (and I even tried copying the query.exe from a Pro system but it errors out). Is there some AutoIt equivalent to the query and logoff functions or am I stuck?
      Edit: I'm adding some clarification to exactly what I'm hoping to get out of this script.
      I'd like to setup a scheduled task that runs outside of the current user (perhaps under the SYSTEM account?) in case NO user is currently active, that will detect which users are currently signed in. If users from a predefined list are not currently active, sign them off entirely.
      So let me give two examples:
      Example #1:
      - I am logged in, but not active (I left my browser open and locked the computer) - Nephew A is logged in, but not active (his time ran out while his game was running and the computer auto-locked) - Nephew B is logged in, and currently playing a game When script runs, ignore my profile (leave it signed in), log out Nephew A (closing his game), and ignore Nephew B because he's actively using the computer. Example #2:
      - I am logged in - Nephew A is logged in - Nephew B is logged in - No users are currently active (Windows is sitting on the choose user / sign in screen) When script runs, ignore my profile, log out Nephew A and Nephew B.  
      I would perceive pseudo code, going as such:
      $aChildUsers = [ 'NephewA', 'NephewB' ] $aUserList = GetSignedInUsers() For $i = 0 to UBound($aUserList)-1 If Not UserIsActive($aUserList[$i]) Then For $j = 0 to UBound($aChildUsers)-1 If $aUserList[$i] = $aChildUsers[$j] Then LogOffUser($aUserList[$i]) Next EndIf Next Obviously, GetSignedInUsers(), UserIsActive(), LogOffUser() are not real functions. What I'm searching for is something of their equivalent.
      Thanks for your time!
    • By paw
      I use SetSoundDevice to control my audio devices but the UI was either
       
      blurry like this:
      or unusable like this:

      so I made this horrible thing to add scaling to the GUI:
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_HiDpi=y #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/sf /sv /rm #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> ;~ _convertGUI("") If $CmdLine[0] <> 0 Then _convertGUI($CmdLine[1]) Func _convertGUI($sFilePath) If $sFilePath <> "" Then Local $aArray = FileReadToArray($sFilePath) Else ;TEST DATA Local $aArray[6] = ['$H_Res_Language = GUICtrlCreateProgress(5, 120, 210 + 25, 480, 20, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE)) ; $CBS_DROPDOWNLIST)', _ 'Local $h_Ok = GUICtrlCreateButton("Ok", 72, 224, 81, 33, 0)', _ 'GUICreate($Warning_TiTle, 700, 310, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX)', _ 'GUICtrlCreateLabel("Output type: ", 30, 130, 65, 20) ;, $SS_RIGHT)', _ '$H_FieldNameEdit = GUICtrlCreateEdit($INP_FieldNameEdit, 100,260+25, 500, 150 - 25) ;comment', 'Local $H_CANCEL = GUICtrlCreateGraphic("Cancel", 224, 224, 97, 33, 0)'] EndIf Local $hTimer = TimerInit(), $iGUIElementCount = 0, $sResult = "", $sFileName = "", $sDrive = "", $sDir = "", $sExtension = "" If @Compiled Then _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) $sFileName = StringRegExpReplace($sFilePath, "^.*\\", "") EndIf For $i = 0 To (UBound($aArray) - 1) If StringRegExp($aArray[$i], "GUICtrlCreate|GUICreate") Then $sResult = _splitComma($aArray[$i]) If Not @error Then $aArray[$i] = $sResult $iGUIElementCount += 1 EndIf Next ConsoleWrite("t = " & TimerDiff($hTimer) & " GUI elements = " & $iGUIElementCount & " lines = " & (UBound($aArray) - 1) & @CRLF) If $sFileName <> "" Then Local $hFile = FileOpen("edited." & $sFileName, 2) _FileWriteFromArray("edited." & $sFileName, $aArray) FileClose($hFile) EndIf Exit EndFunc ;==>_convertGUI Func _splitComma($sString) Local $sSplitResult = "", $sTrimmedR = "", $sTrimmedL = "" Local $aSplit = StringSplit($sString, ',') If Not @error Then $sTrimmedR = "" $sTrimmedL = "" For $j = 1 To $aSplit[0] If StringRegExp($aSplit[1], "(?:.GUICtrlCreateGraphic|GUICtrlCreateProgress|GUICtrlCreateSlider|GUICtrlCreateTab|GUICtrlCreateTreeView)") Then If $j = 1 Then While StringLeft($aSplit[$j], 1) <> '(' $sTrimmedL &= StringLeft($aSplit[$j], 1) $aSplit[$j] = StringTrimLeft($aSplit[$j], 1) WEnd $aSplit[$j] = StringTrimLeft($aSplit[$j], 1) EndIf EndIf If $j = $aSplit[0] Then While StringRight($aSplit[$j], 1) <> ')' $sTrimmedR &= StringRight($aSplit[$j], 1) $aSplit[$j] = StringTrimRight($aSplit[$j], 1) WEnd $aSplit[$j] = StringTrimRight($aSplit[$j], 1) EndIf If StringRegExp($aSplit[$j], "[0-9]") And $aSplit[$j] <> -1 And $aSplit[$j] <> 0 And $aSplit[$j] <> 1 And Not StringInStr($aSplit[$j], ')') Then If StringRegExp($aSplit[$j], "\-|\+") Then ;put parenthesis around + or - $aSplit[$j] = '(' & $aSplit[$j] & ")*$g_DPI" Else $aSplit[$j] = $aSplit[$j] & "*$g_DPI" EndIf EndIf If $j < $aSplit[0] Then $sSplitResult &= $aSplit[$j] & ',' ElseIf $j = $aSplit[0] Then $sSplitResult &= $aSplit[$j] & ')' Else $sSplitResult &= $aSplit[$j] EndIf Next If $sTrimmedR <> "" Then $sSplitResult &= StringReverse($sTrimmedR) If $sTrimmedL <> "" Then $sSplitResult = $sTrimmedL & '(' & $sSplitResult Else SetError(1) Return EndIf ConsoleWrite($sSplitResult & @CRLF) Return $sSplitResult EndFunc ;==>_splitComma
      And now it looks good: 
      but it doesn't work on everything, for example the "GUICtrlCreateLabel("Output type: ", 30, 130, 65, 20) ;, $SS_RIGHT)" (from the autoit3wrapper gui)
      because the comment contains a parenthesis and it would break completely if there were variables as parameters..
      Is there some kind of parser around that I could use instead or maybe someone who has already done something like this?
×
×
  • Create New...