Jump to content

Place Label control over Progress control


Recommended Posts

Hi everybody,

since AutoIt V3.3.8.0 is released I have to modify some of my scripts.

I often use a Progress control UDF by ProgAndy (http://progandy.de/downloads/view.download/11).

Now, with the new version of AutoIt, the color gradient doesn't work anymore. I would like to avoid using this UDF.

Is there a way to permanently place a Label control over a Progress control?

If updating the bar position the Label text disappears...

Here's some sample code:

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

Local $hGUI = GUICreate("", 500, 500, -1, -1)
Local $hGUI_P = GUICtrlCreateProgress(10, 10, 480, 20)
Local $hGUI_L = GUICtrlCreateLabel("Text to place over progress control", 10, 10, 480, 20, BitOR($BS_CENTER, $SS_CENTER))

GUICtrlSetBkColor($hGUI_L, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW, $hGUI)

For $i = 1 To 100 Step 1
GUICtrlSetData($hGUI_P, $i)
Sleep(100)
Next

Local $hMsg = 0
Do
$hMsg = GUIGetMsg()
Until $hMsg = $GUI_EVENT_CLOSE

Please, could anyone give me a clue to solve this issue?

Greets,

-supersonic.

Link to comment
Share on other sites

With some modification should fill your need.

I don't have the answer to the actual problem, but it appears that the script (above address) does.

If you are looking for gradient:

I don't mean to sound condescending, but a quick Google search of "AutoIT progress label" got me more info than I need to keep me learning about this subject for weeks. :)

Google is sometimes a better (no offense to site owner) resource than the forums' search (opinion) as it seems that Google has more cash to spend on search engines.

Link to comment
Share on other sites

  • 3 weeks later...

The OP has probably already dealt with this, but I use this and here's how you fix it.

OP should have posted in Prog@ndy's thread Progressbar with GDIplus

Add Round() Int() to these three lines in GDIpProgress.au3

Edit: just the kind of obvious mistake I usually make

Thanks UEZ

;===============================================================================
;
; Function Name:   _Gradient($RGB_Color1 ,$RGB_Color2, $Count)
; Description:: Returns an Array of Gradient Colors
; Parameter(s): $RGB_Color1 : The Start-Color in RGB Hexadecimal
;                 $RGB_Color2 : The End-Color in RGB Hexadecimal
;                 $Count :    The number of Colors in the Gradient
; Requirement(s):
; Return Value(s): An Array with the Colors
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _Gradient($RGB_Color1, $RGB_Color2, $Count, $ARGB = False)
Local $Color1_R, $Color1_G, $Color1_B, $Color2_R, $Color2_G, $Color2_B, $NeuCol_R, $NeuCol_G, $NeuCol_B
$ARGB = StringLeft("FF", 2 * $ARGB)
$Color1_R = BitAND(BitShift($RGB_Color1, 16), 0xff)
$Color1_G = BitAND(BitShift($RGB_Color1, 8), 0xff)
$Color1_B = BitAND($RGB_Color1, 0xff)
$Color2_R = BitAND(BitShift($RGB_Color2, 16), 0xff)
$Color2_G = BitAND(BitShift($RGB_Color2, 8), 0xff)
$Color2_B = BitAND($RGB_Color2, 0xff)
$Count -= 1 ; 0-basiert !
Local $arColors[$Count + 1], $pos1
For $i = 0 To $Count
  $pos1 = $Count - $i
;-------------------------
  $NeuCol_R = Int(($Color1_R * $pos1 + $Color2_R * $i) / ($Count))
  $NeuCol_G = Int(($Color1_G * $pos1 + $Color2_G * $i) / ($Count))
  $NeuCol_B = Int(($Color1_B * $pos1 + $Color2_B * $i) / ($Count))
;-------------------------
  $arColors[$i] = Execute('0x' & $ARGB & Hex($NeuCol_R, 2) & Hex($NeuCol_G, 2) & Hex($NeuCol_B, 2))
Next
Return $arColors
EndFunc   ;==>_Gradient
Edited by rover

I see fascists...

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