Jump to content

Label in Gui transparent


Recommended Posts

Hi, everyone

How to set text in Label control is see as clear as when GUi is not transparent. (Google translate)

Thank

 

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

$Gui = GUICreate("", 300, 150)
$Label = GUICtrlCreateLabel("Text on GUI Tranparent", 50, 30, 200, 25, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont( -1, 14)
GUISetState()
WinSetTrans($Gui, "", 100)

While 1
    if GUIGetMsg() = $GUI_EVENT_CLOSE then ExitLoop
    sleep(10)
WEnd

 

Edited by 123disconnect
Link to comment
Share on other sites

#Include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

$Gui = GUICreate("", 300, 150, -1, -1, -1, $WS_EX_LAYERED)
$Label = GUICtrlCreateLabel("Text on GUI not Tranparent", 50, 30, 200, 25, BitOR($SS_CENTER,$SS_CENTERIMAGE))

GUISetBkColor(0x0000FF)
_WinAPI_SetLayeredWindowAttributes($Gui, 0x0000FF)

GUISetState()

While 1
    if GUIGetMsg() = $GUI_EVENT_CLOSE then ExitLoop
    sleep(10)
WEnd

 

Edited by SlackerAl

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

 

21 hours ago, SlackerAl said:
#Include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

$Gui = GUICreate("", 300, 150, -1, -1, -1, $WS_EX_LAYERED)
$Label = GUICtrlCreateLabel("Text on GUI not Tranparent", 50, 30, 200, 25, BitOR($SS_CENTER,$SS_CENTERIMAGE))

GUISetBkColor(0x0000FF)
_WinAPI_SetLayeredWindowAttributes($Gui, 0x0000FF)

GUISetState()

While 1
    if GUIGetMsg() = $GUI_EVENT_CLOSE then ExitLoop
    sleep(10)
WEnd

 

Thank SlackerAl

This code , I can search in forum

With one GUI only. Can you set background is blur And text on label see as clear label ?

 

Link to comment
Share on other sites

I'm not sure what you are asking for here:

1) Your original post has the whole GUI and contents as transparent

2) My version has the form as transparent and the label as normal.

3) If you want the form less transparent set the value of $iTransGUI to a suitable value in the _WinAPI_SetLayeredWindowAttributes command.

4) When you say "text on label see as clear label" are you saying you don't want to see the label text? (In which case you can just set the text to "").

5) Can you post an image of what you wish to achieve?

6) Transparent label, solid GUI seems to be covered here: 

 

Edited by SlackerAl
Added 6)

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

I think he meant something like this :

#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <SendMessage.au3>
#include <Constants.au3>
#include <ScreenCapture.au3>
#include <WinAPISysWin.au3>
#include <FontConstants.au3>

_GDIPlus_Startup()

Local $hGUI = GUICreate("", 300, 200, 150, 150, $WS_POPUP+$WS_BORDER)
$hGUI_c = GUICreate("", 200, 100, 100, 50, $WS_POPUP,$WS_EX_LAYERED+$WS_EX_TRANSPARENT+$WS_EX_MDICHILD, $hGUI)
GUISetBkColor(0xFFFFFF, $hGUI_c)
$idLabel = GUICtrlCreateLabel("This is a test", 0, 0, 100, 30, $SS_CENTER)
GUICtrlSetFont (-1, 12, $FW_BOLD)
_WinAPI_SetLayeredWindowAttributes($hGUI_c, 0xFFFFFF)

Local $iCW = _WinAPI_GetClientWidth($hGUI), $iCH = _WinAPI_GetClientHeight($hGUI)
Local $aPos = WinGetPos ($hGUI), $iBorder = Int (($aPos[2]-$iCW)/2), $iTopBorder = $aPos[3]-$iCH-$iBorder

Local $hBitmap = _ScreenCapture_Capture("",$aPos[0]+$iBorder, $aPos[1]+$iTopBorder, $aPos[0]+$iBorder+$iCW, $aPos[1]+$iTopBorder+$iCH)
Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)

Local $hEffect = _GDIPlus_EffectCreateBlur(5)
_GDIPlus_BitmapApplyEffect($hImage, $hEffect)
GUISetState(@SW_SHOW, $hGUI)
GUISetState(@SW_SHOWNA, $hGUI_c)

_GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iCW, $iCH)

While True
  Switch GUIGetMsg ()
    Case $GUI_EVENT_CLOSE
      ExitLoop
  EndSwitch
WEnd

_GDIPlus_GraphicsDispose($hGraphics)
_WinAPI_DeleteObject ($hBitmap)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown ()

 

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