Jump to content

Transparent Groups, Radio, and Missing Tabs


Go to solution Solved by Melba23,

Recommended Posts

Hello,

I would like to know how to go about making the following item clear and transparent.   They're currently being highlight by a blue/black bar over the texts.  I've read through pages and pages of "transparent group, radios, and checkboxes" but none looks like a simple implemenation nor does it apply to my case.

  • Groups Text
  • Radio Text

Also, I'm unable to see my tabs perhaps it's being hidden by the background picture? (see figure 2 for what it's supposed to look like).  Using the code from AdmiralClaws, it made the radio graphic or style a little plain and I would like to restore it.  I don't need the tab section transparent, just the dark grey area around it.
 

Example:

$chk = GUICtrlCreateCheckbox("This is checkbox - Lorem ipsum dolor sit amet.", 20, 20)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)
$lbl = GUICtrlCreateLabel("This is label - Lorem ipsum dolor sit amet", 20, 100)
$rdo = GUICtrlCreateRadio("This is radio - Lorem ipsum dolor sit amet", 20, 180)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)

Test Program

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

Example()

Func Example()

    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 400, 300)
    ; GUICtrlCreatePic (".\background.bmp", 0, 0, 400, 300)
    GUICtrlCreateTab (20, 20, 360, 260)
    GUICtrlCreateTabItem ("Option 1")
    GUICtrlCreateGroup ("Radio", 40, 60, 320, 200)
    $radio1 = GUICtrlCreateRadio ("Radio 1", 60, 80)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio1), "wstr", 0, "wstr", 0)
    $radio2 = GUICtrlCreateRadio ("Radio 2", 60, 110)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio2), "wstr", 0, "wstr", 0)

    GUICtrlCreateTab (30, 30, 360, 260)
    GUICtrlCreateTabItem ("Option 2")
    GUICtrlCreateGroup ("Radio", 40, 60, 320, 200)
    $radio3 = GUICtrlCreateRadio ("Radio 3", 60, 80)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)
    $radio4 = GUICtrlCreateRadio ("Radio 4", 60, 110)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    ; Delete the previous GUIs and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

test1.jpg

(Figure 1)

test2.jpg

(Figure 2)

Edited by dreamzboy
Link to comment
Share on other sites

  • Moderators
  • Solution

dreamzboy,

Create the background picture after the tabs and set the $WS_CLIPSIBLINGS style - then you see the tab control. In this example I have also corrected the tab creation code and added a little extra code to force the tabs to fill the entire control (otherwise you get a nasty grey area at top right where there are no tabs): :)

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

Example()

Func Example()

    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 400, 300)

    $cTab = GUICtrlCreateTab (20, 20, 360, 260, $TCS_FIXEDWIDTH) ; Add style for user-defined tab width
    GUICtrlCreateTabItem ("Option 1")
    GUICtrlCreateGroup ("Radio A", 40, 60, 320, 200)
    $radio1 = GUICtrlCreateRadio ("Radio 1", 60, 80)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio1), "wstr", 0, "wstr", 0)
    $radio2 = GUICtrlCreateRadio ("Radio 2", 60, 110)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio2), "wstr", 0, "wstr", 0)

    GUICtrlCreateTabItem ("Option 2")
    GUICtrlCreateGroup ("Radio B", 40, 60, 320, 200)
    $radio3 = GUICtrlCreateRadio ("Radio 3", 60, 80)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)
    $radio4 = GUICtrlCreateRadio ("Radio 4", 60, 110)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)

    GUICtrlCreateTabItem ("")

    ; Force tabs to cover whole width of control
    $aPos = ControlGetPos($hGUI, "", $cTab)
    Local $iTabWidth = Int(($aPos[2] - 3) / 2)
    Local $iTabHeight = Int(20 * $iTabWidth / 190)
    Local $iParam = BitOR(BitAND($iTabWidth, 0xFFFF), BitShift(BitAND($iTabHeight, 0xFFFF), -16))
    GUICtrlSendMsg($cTab, $TCM_SETITEMSIZE, 0, $iParam)

    GUICtrlCreatePic ("Image_path", 0, 0, 400, 300, $WS_CLIPSIBLINGS) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    GUICtrlSetState(-1, $GUI_DISABLE)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    ; Delete the previous GUIs and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example
I hope that helps. :)

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 comment
Share on other sites

  • 8 years later...

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

×
×
  • Create New...