Jump to content

Recommended Posts

Posted

Hello there! Today i want to ask you how to draw a shadow around a GUI Control, whether it is button, or label, or anything else. Thanks in advance! 

Posted

Maybe you'll have to mess with transparency and overlays, using an image with a shadow and transparency, placing it over a button...idk, seems complicated.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Something like this?

#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>

Global $hMain = GUICreate("")
Global $btnOne = GUICtrlCreateButton("", 10, 10, 100, 20)
Global $lblText = GUICtrlCreateLabel("This is some text", 110, 40, 100, 20)

GUISetState(@SW_SHOW, $hMain)

GUICtrlAddShadow($btnOne)
GUICtrlAddShadow($lblText)

While (True)
    Switch (GUIGetMsg())
        Case $GUI_EVENT_CLOSE
            Exit 0
    EndSwitch
WEnd

Func GUICtrlAddShadow(Const $iCtrl)
    Local $hCtrl = GUICtrlGetHandle($ictrl)
    Local $hParent = _WinAPI_GetParent($hCtrl)
    Local $aPos = ControlGetPos($hParent, "", $iCtrl)
    Local $lblShadow = GUICtrlCreateLabel("", $aPos[0] + 3, $aPos[1] + 3, $aPos[2], $aPos[3])
    GUICtrlSetBkColor($lblShadow, 0x3E3E3E)
    GUICtrlSetState($lblShadow, $GUI_DISABLE)
    GUICtrlSetState($iCtrl, $GUI_ONTOP)
    _SendMessage($hCtrl, $WM_MOUSEFIRST)
    Return $lblShadow
EndFunc

Couldn't figure out how to refresh the control and make it on top of the shadow but calling AddShadow after the GUI is shown + the _SendMessage + setting the control to ONTOP did it.

_WinApi_RedrawWindow didn't work (using $hCtrl and $hParent, neither worked)

Posted (edited)

Interesting question. Have you tried all the control styles? Here's an idea: take a screenshot of your GUI, draw the shadow around the controls using graphics software and then set the image as the GUI background. For resizing you'll have to ask a graphics expert.

Edited by czardas
Posted (edited)
13 minutes ago, czardas said:

Interesting question. Have you tried all the control styles? Here's an idea: take a screenshot of your GUI, draw the shadow around the controls using graphics software and then set the image as the GUI background. For resizing you'll have to ask a graphics expert.

 
 

I just wanna find out how to draw a shadow around a GUI Control only by using codes, without using images and other stuff like that.

Edited by Renderer
Posted (edited)

Ah, then try all the control styles. I don't know if there is a universal drop shadow style which applies to all control types - I kind of doubt it. It might should be possible to redraw everything using code, but don't ask me how.

Edit1: The styles I've tried seem to only do 3D type effects for controls like buttons (not specifically drop shadow).

Edit2: GDI+ is another possibility. It's probably the easiest approach. You might even find something in example scripts.

Edited by czardas
  • Moderators
Posted

Renderer,

This thread shows how it was done on XP & Vista - but I have no idea if it still works with more modern OSes.

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

 

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
×
×
  • Create New...