Jump to content

SOLVED - Transparent GUI Object


Recommended Posts

Hello autoit community,

I have a gui, and I want to place a special DataPicker on the GUI too, but If I put it in a visible GUICtrlCreateObj() it will be so unprofessional, and sloppy.

So I only want to make he object transparent, so only the datapicker is visible on the gui. I searched he forom, found _WinAPI_SetLayeredWindowAttributes and changed the bkg of the object with no success.

If anyone can help on this, I'll be thankful.

Here is my simple code : ( I have uploaded the needed files too )

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

$hMain = GUICreate("Transparency Window",600,400)


Local $oIE = _IECreateEmbedded()


$55 = GUICtrlCreateObj($oIE, 10, 40, 300, 350)
_IENavigate($oIE, @ScriptDir & "\DatePicker\sample.html")



GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

If you have any suggestion for me to even replace the GUICtrlCreateObj(), so only the datapicker is visible, it will be great too. ( Out of the box thinking )

DatePicker.rar

Link to post
Share on other sites

I think no one is interested in this topic, or wans o help. 

As I was searching I found that _WINAPI based drawings are better controlled as being transparent. But I don't know if and how I can use them as a embedding object. 

Link to post
Share on other sites

Something like this ??

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

#include <WinAPI.au3>
Local $AlphaKey = 1 ; the transparent color of your choice

$hMain = GUICreate("Transparency Window", 600, 400, -1, -1, -1, $WS_EX_LAYERED)
GUISetBkColor($AlphaKey, $hMain)
_WinAPI_SetLayeredWindowAttributes($hMain, $AlphaKey, 0, $LWA_COLORKEY)

Local $oIE = _IECreateEmbedded()

$55 = GUICtrlCreateObj($oIE, 10, 40, 300, 350)
_IENavigate($oIE, @ScriptDir & ".\sample.html")
$oIE.document.body.style.backgroundColor = $AlphaKey

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to post
Share on other sites

Thanks for your help. This is so close, but what it I only want the object to be transparent, not the whole GUI.

And another question, how can I flatten borders of the GUI.

I want to include the JS, in my main GUI, so I can use the DatePicker function of the JS, but I want it to be part of the main GUI, not a different and bordered object.

Link to post
Share on other sites

What have you tried so far ?

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to post
Share on other sites

  

On 10/31/2020 at 1:38 PM, caramen said:

What have you tried so far ?

I did try to manipulate  @Chimp code, and tried so many solutions I found I the forum, which did not help. 

 

3 hours ago, JoHanatCent said:

Have you tried:

GUICtrlCreateDate with example in help?

Unfortunately it does not support custom date by setting a language variable. ( Our language variable is @OSLang = 1065 )

 

 I Found a solution for the topics issue, by using the @Chimp code, and moving the embedded screen for a negative position. ( I don't know why I didn't think of that sooner. )

 

This is my final code

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

Local $AlphaKey = 1 ; the transparent color of your choice

$Date_GUI = GUICreate("Transparency Window", 250, 250, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor($AlphaKey, $Date_GUI)
_WinAPI_SetLayeredWindowAttributes($Date_GUI, $AlphaKey, 0, $LWA_COLORKEY)

$Persian_Date_IE = _IECreateEmbedded()

GUICtrlCreateObj($Persian_Date_IE, -2, -50, 1000, 1000)
_IENavigate($Persian_Date_IE, @ScriptDir & "\ShamsiCalendar\jalali.html")
$Persian_Date_IE.document.body.style.backgroundColor = $AlphaKey

GUISetState(@SW_SHOW,$Date_GUI)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

 

Edited by Siwa
Link to post
Share on other sites
  • Siwa changed the title to SOLVED - Transparent GUI Object

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.

×
×
  • Create New...