Sign in to follow this  
Followers 0
qwert

Attempt at using PNG background

22 posts in this topic

#1 ·  Posted (edited)

I've been working toward using a PNG as a background for a free-floating GUI, but have encountered several problems. Being fairly new to AutoIt, I know I'm pushing beyond the limits of my real understanding -- but I'm trying to learn. And I know my attempt is probably pretty crude -- but it's taken me days to get this far. Here's what I have:

#include <GuiConstants.au3>
#Include <GDIPlus.au3>
Opt("MustDeclareVars", 0)
Global Const $AC_SRC_ALPHA = 1
Global Const $ULW_ALPHA = 2

HotKeySet("{ESC}", "QuitApp")
_GDIPlus_Startup()
; Create Window and Put Up Graphic 
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Frame.png")
; Extract image width and height from PNG
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
; Create layered window
$GUI = GUICreate("MainDisplay", $width, $height, 200, 200, $WS_POPUP, $WS_EX_LAYERED)
SetBitmap($GUI, $hImage, 0)
$Button = GUICtrlCreateButton(" Exit ", 300, 10, 80, 40)
GUISetState()
WinSetOnTop($GUI, "", 1)
;fade in png background
For $i = 0 To 255 Step 10
    SetBitmap($GUI, $hImage, $i)
Next
; create child MDI gui window to hold controls
$controlGui = GUICreate("Input", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)
GUICtrlCreatePic(@ScriptDir & "\blankBG.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)

$Info_Edit = GUICtrlCreateEdit("", 20, 30, 294, 200, $ES_RIGHT + $WS_VSCROLL)
GUICtrlSetColor(-1, 0xFFFFFE)
GUICtrlSetFont($Info_Edit, 20, 600)
GUISetState()

While 1
  $Msg = GUIGetMsg()
if $Msg = $Button Then Exitloop
Sleep(200)
WEnd

;= THE FOLLOWING FUNCS WERE BORROWED FROM WORKING EXAMPLES AND SHOULD BE OK =
Func QuitApp()
    Exit
EndFunc

Func SetBitmap($hGUI, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc;==>SetBitmap

The main problems are:

1) the text entry control should have a white background << resolved ... I think

2) the Exit button doesn't show up (but it's there and does work -- sort of)

3) there is a pronounced delay -- sometimes several seconds -- in exiting after clicking the (hidden) Exit button

4) the corners of the PNG background are white, not transparent << resolved ... new PNG is attached

5) the text entry control won't accept keyboard input

Would someone please be so kind as to point out some of the obvious problems so that I can be a little closer to my goal?

Many thanks to anyone willing to help.

post-29172-1206400673_thumb.png

Edited by qwert

Share this post


Link to post
Share on other sites



For 4) the corners of the PNG background are white, not transparent..

Try opening the PNG in an editor and set the white as a transparent color.

I did it with irfranview took 2 secs and the image loads with transparent corners.

as for the rest , keep trying you'll get it worked out eventually.

Cheers

Share this post


Link to post
Share on other sites

For 4) set the white as a transparent color.

Yes, thanks very much. That worked. I now know what my editor meant by "Alpha Channel".

Anyone willing to critique the entire script? Where am I going wrong on the others? I'm almost sure it something like "Well, on Layered GUIs, you need to consider ___ and ____." But what?

Share this post


Link to post
Share on other sites

As I mentioned, I must be missing something very basic to using layered GUIs. I haven't been able to make progress on the remaining problems -- although running the script on a different PC did seem to reduce the exit delay by about half. Something still just seems wrong with the Exit logic.

Any help will be appreciated.

Share this post


Link to post
Share on other sites

Well, one more day's work has netted one additional answer:

GUICtrlSetBkColor (-1, 0xFFFFFF) doesn't work because it's setting to White, which is the designated transparency color for the PNG -- so it becomes transparent as well.

Setting the color to 0xFFFFFE works, but I wonder if there's a better "global" solution.

Now if I could only get the Exit button to show up !

Share this post


Link to post
Share on other sites

Hi Qwert,

I've got your source code and i'm working some of the problems your having, as they appear to have a benefit to projects i'm working on.

will post up any code i think would benefit you


RichE

[font="'Arial Narrow';"]Current projects[/font]

[font="'Arial Narrow';"]are on my site [/font]Sellostring

Share this post


Link to post
Share on other sites

Qwert,

I've removed the Hotkey Command, you don't need it, it escapes by default (or does for me)

also i've incorporated the exit function into the case select listing

CODE
While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $button

ExitLoop

sleep(200)

EndSwitch

WEnd

and also changed the step variable to 2 just to make the fade in abit smoother


RichE

[font="'Arial Narrow';"]Current projects[/font]

[font="'Arial Narrow';"]are on my site [/font]Sellostring

Share this post


Link to post
Share on other sites

There is a solution to the invisible button and the delay you were getting on exit:

#include <GuiConstants.au3>
#Include <GDIPlus.au3>
Opt("MustDeclareVars", 0)
Global Const $AC_SRC_ALPHA = 1
Global Const $ULW_ALPHA = 2

HotKeySet("{ESC}", "QuitApp")
_GDIPlus_Startup()
; Create Window and Put Up Graphic
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir &"autoitlogocolorvq0.png")
; Extract image width and height from PNG
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
; Create layered window
$GUI = GUICreate("MainDisplay", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetBitmap($GUI, $hImage, 0)

GUISetState()
WinSetOnTop($GUI, "", 1)
;fade in png background
For $i = 0 To 255 Step 10
    SetBitmap($GUI, $hImage, $i)
Next
; create child MDI gui window to hold controls
$controlGui = GUICreate("Input", $width, $height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)
GUICtrlCreatePic(@ScriptDir & "grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button = GUICtrlCreateButton("Exit", 25, 0, 60, 20)
$Info_Edit = GUICtrlCreateEdit("", 20, 30, 200, 20, $ES_RIGHT)
GUICtrlSetColor(-1, 0xFFFFFE)
;GUICtrlSetFont($Info_Edit, 20, 600)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    If $Msg = $Button Then Exit
    Sleep(10)
WEnd

;= THE FOLLOWING FUNCS WERE BORROWED FROM WORKING EXAMPLES AND SHOULD BE OK =
Func QuitApp()
    Exit
EndFunc

Func SetBitmap($hGUI, $hImage, $iOpacity)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc;==>SetBitmap

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

BTW, I'm using the solution from this thread insted for loading PNGs, it's a lot simpler, and combined with your layered GUI it's working perfect. So many GDI functions is too confusing.

http://www.autoitscript.com/forum/index.ph...c=65402&hl=

Cheers

Edited by Oldschool

Share this post


Link to post
Share on other sites

OldSchool, thank you very much for your replies.

I will be able to move forward again and I have been working to understand the differences from what I had. I see that your methods work, but some of the reasons aren't apparent to me. Specifically:

1. Was there any significance to changing the order of these steps? They seem to work either way:

GUISetState()

WinSetOnTop($GUI, "", 1)

2. Moving the Exit button in front of the Input definition works, but it implies that the order of controls affects how they are displayed. Can that be true? And is there some other way to control their visibility?

3. Concerning the pause on exit, your Sleep(10) is quick, but setting it back to Sleep(200) seems to invoke much more than a 1/5 second pause. Is there something else to consider?

BTW, I'm using the solution from this thread insted for loading PNGs, it's a lot simpler, and combined with your layered GUI it's working perfect. So many GDI functions is too confusing.

http://www.autoitscript.com/forum/index.ph...c=65402&hl=

I viewed the topic (about animated GIFs) but couldn't spot the simplification you are suggesting. Can you point me to the specific technique? Or maybe point out which steps in my script I should replace?

Thanks again for your help.

Share this post


Link to post
Share on other sites

1) Not sure

2) What is happening is it's not 1 GUI with 2 layers, it's 2 GUIs you are dealing with by the looks of it. I moved the $button variable into the second GUI zone.

3) When it's sleep 200 it completely misses some clicks while sleeping

If I understood your goal correctly, you want to use a .png as a background, and set a bunch of controls on top of it.

Check this out:

#include <GuiConstants.au3>
HotKeySet("{TAB}", "_Terminate")
$img = @ScriptDir & "\Frame.png"
Global $iGuiW = 600, $iGuiH = 200, $sTitle = "GUI Example"
$hGui = GUICreate($sTitle, $iGuiW, $iGuiH, -1, -1, $WS_POPUPWINDOW, $WS_EX_APPWINDOW)
GUISetState()
AddImage()

$imgBg= "C:\Documents and Settings\User2\Desktop\AutoIt Extras\lod3n_launcher\" & "grey.gif"
$controlGui = GUICreate("Input", $iGuiW, $iGuiH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGui)
GUICtrlCreatePic($imgBg, 0, 0, $iGuiW, $iGuiH)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState()

$LabelColor = 0xFA0C0A
GUICtrlCreateLabel("Some Label:", 20, 100)
GUICtrlSetColor(-1, $LabelColor)
GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT)
$updwn_bb = GUICtrlCreateInput("", 20, 115, 70, 20)
GUICtrlSetLimit(-1, 4)

$button_run = GUICtrlCreateButton("Start", 20, 60, 100, 20)
GUICtrlSetColor(-1, $LabelColor)
GUICtrlSetBkColor (-1, $GUI_BKCOLOR_TRANSPARENT)

While 1
    Sleep(10)
    $msg = GUIGetMsg()
    Select       
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button_run
            MsgBox(0, "", "Button works!")
    EndSelect
WEnd

Func _Terminate()
    Exit 0
EndFunc

FUNC AddImage()
    LOCAL $x = ObjCreate("Shell.Explorer.2")
    IF IsObj($x) THEN
       GUICtrlCreateObj($x,0,0,600,200)
       $x.navigate("about:blank")
       WHILE $x.Busy()
          Sleep(20)
       WEND
       $x.document.body.background = $img
       $x.document.body.scroll = "no"
       $x.document.body.style.border = "0px"
    ENDIF
ENDFUNC; AddGif

Share this post


Link to post
Share on other sites

If I understood your goal correctly, you want to use a .png as a background, and set a bunch of controls on top of it.

Yes, that's exactly my goal.

I ran this latest example and I see how the AddImage function replaces what I had picked up from another post. But I'm a confused by the result. For instance, there's now a 1 pix frame around the entire GUI that wasn't there with the other technique. (I need the transparency effect from my original script.) And I guess I've never understood the purpose of the gray.gif image.

I guess I've lost my bearings a bit. I thought I was building a layered GUI -- with a PNG as the background of the parent and a child GUI (on top) to hold the controls. But as you pointed out, it's just two GUIs. Now, an alternative seems to be a child GUI with the PNG as its background. Or is there a better (third) choice, considering what my goal is?

I felt I was getting closer, but now I'm not sure I'm on a correct path.

Any further help will be appreciated. Thanks for what you've done so far.

Share this post


Link to post
Share on other sites

I hear you...

If grey.gif is removed the top controls are no longer visible.

I don't understand a couple of things about the technique myself. For instance, why the button stops working when you remove GUICtrlSetState(-1, $GUI_DISABLE) in line 12 is a complete mystery to me. I just concocted it from your OP, and that other link, cause I'm making a GUI myself.

Anyways, you can remove the border I'm sure by changing the 'Style' in GUICreates.

Good luck, post code if you get what you wanted...

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I guess I've lost my bearings a bit. I thought I was building a layered GUI -- with a PNG as the background of the parent and a child GUI (on top) to hold the controls. But as you pointed out, it's just two GUIs. Now, an alternative seems to be a child GUI with the PNG as its background. Or is there a better (third) choice, considering what my goal is?

I'd hate to come in and muddy things up, so ignore this post if I've strayed too far...but does the image have to be a png? If you set up your GUI with $WS_POPUP as the style and $WS_EX_LAYERED+$WS_EX_TOOLWINDOW as the extended style, then create a pic control that's the full width and height of your GUI showing a .bmp file instead (and disable the pic control so it stays a background), the color in the top-left pixel of the bmp will be set to transparent for that GUI, allowing you to have your rounded corners still.

I don't know if that will help, but maybe a different method will work better for you, since your original method seems to be dogged with troubles.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Edit: this seemed to work just like you want, for me. Just make sure that frame.bmp is in the same directory as your script (I just filled your transparent corners back in with White and saved as a bmp). Note I changed the look of your Exit button...feel free to do whatever you want, obviously. Just don't let a control overlap the invisible drag bar in the top 15 pixels of the window (allows you to move the window around...again, just delete if you don't want this functionality), or you'll be clicking the drag bar instead of the control you can see...it'd make your exit button seem like it didn't work.

#include <GUIConstants.au3>
Global $BGSize[2]=[358,294]

$GUI=GUICreate("Main Display",$BGSize[0],$BGSize[1],200,200,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_TOOLWINDOW)
GUICtrlCreatePic(@ScriptDir&"\frame.bmp",0,0,$BGSize[0],$BGSize[1])
GUICtrlSetState(-1,$GUI_DISABLE)

$DragBar = GUICtrlCreateLabel("",0,0,$BGSize[0]-15,15,Default,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
$ExitButton = GUICtrlCreateLabel("X", $BGSize[0]-15, 0, 15, 15,$SS_NOTIFY+$SS_CENTER)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)

$Info_Edit = GUICtrlCreateEdit("", 20, 30, 294, 200, $ES_RIGHT + $WS_VSCROLL)
GUICtrlSetBkColor(-1,0xFFFFFE)
GUICtrlSetFont($Info_Edit, 20, 600)

GUISetState()
WinSetOnTop($GUI, "", 1)

While 1
    Switch GUIGetMsg()
        Case $ExitButton
            ExitLoop
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    sleep(15)
WEnd

Edit2: my first post didn't actually work, after all. The 'fade-in' effect that I provided using WinSetTrans(), simulating your fade-in, seemed to mess up the transparency. This works, but doesn't fade in.

Subsequent edits: a bit of fit-and-finish work on my code (mostly for portability) :)

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

maybe a different method will work better for you, since your original method seems to be dogged with troubles.

THANK YOU! You hit the nail on the head.

I greatly appreciate the simplicity your example brings to the problem. It's less than half the size and every line in your script has a clear meaning and purpose -- which was not the case with the (borrowed) blending and layered window updates in my original example.

I did not know a bmp could be used to get the transparent effect. There are hundreds of post on these forums discussing PNGs to achieve it. I guess I took a more complicated path. But is there some consideration other than image file size in bytes? In other words, why so much emphasis on PNGs and when are they preferred?

Anyway, I consider this a real leap forward for me -- and I hope others benefit, as well.

Thanks again for your contribution of simplicity.

Share this post


Link to post
Share on other sites

THANK YOU! You hit the nail on the head.

I greatly appreciate the simplicity your example brings to the problem. It's less than half the size and every line in your script has a clear meaning and purpose -- which was not the case with the (borrowed) blending and layered window updates in my original example.

I did not know a bmp could be used to get the transparent effect. There are hundreds of post on these forums discussing PNGs to achieve it. I guess I took a more complicated path. But is there some consideration other than image file size in bytes? In other words, why so much emphasis on PNGs and when are they preferred?

Anyway, I consider this a real leap forward for me -- and I hope others benefit, as well.

Thanks again for your contribution of simplicity.

Glad to help :)

I didn't know myself that a bmp could be used thus, until madflame991 wowed the AutoIt world (or me, at least). So I'm simply borrowing, too. Fortunately, it's quite clear what happens, so it doesn't get jumbled or bloated when I borrow it :)

I think pngs are used because they're DESIGNED to have transparency, so that's what everyone thinks of. beyond that, I'm not sure if there's a definite benefit; maybe a png can only be one element in a GUI (allow you to see controls under it or overlap controls), where a bmp used this way must be the entire gui background? I don't know, that's a pure guess. Possibly there are other benefits as well, but this type of application is all I've needed, so I never got into it.

By the way, I discovered something amusing in the example I gave you; there's apparently a thin border of pure white around the Edit box, as I can see through its border when it's over a very contrasting color. Maybe you should use a different color than white in your bmp so that doesn't happen (it would also then allow you to get rid of setting the edit to 0xFFFFFE, as white would no longer be the transparent color).

Happy coding :party:


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

@James3

That is definitely a nice and clean example.

It would not work with an animated gif, but for everything else you could not get any more efficient.

@OP, your original post did not go to waste. I learned a couple of things out of it for sure...

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

I'd hate to come in and muddy things up, so ignore this post if I've strayed too far...but does the image have to be a png? If you set up your GUI with $WS_POPUP as the style and $WS_EX_LAYERED+$WS_EX_TOOLWINDOW as the extended style, then create a pic control that's the full width and height of your GUI showing a .bmp file instead (and disable the pic control so it stays a background), the color in the top-left pixel of the bmp will be set to transparent for that GUI, allowing you to have your rounded corners still.

I don't know if that will help, but maybe a different method will work better for you, since your original method seems to be dogged with troubles.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Edit: this seemed to work just like you want, for me. Just make sure that frame.bmp is in the same directory as your script (I just filled your transparent corners back in with White and saved as a bmp). Note I changed the look of your Exit button...feel free to do whatever you want, obviously. Just don't let a control overlap the invisible drag bar in the top 15 pixels of the window (allows you to move the window around...again, just delete if you don't want this functionality), or you'll be clicking the drag bar instead of the control you can see...it'd make your exit button seem like it didn't work.

<code snipped>

Edit2: my first post didn't actually work, after all. The 'fade-in' effect that I provided using WinSetTrans(), simulating your fade-in, seemed to mess up the transparency. This works, but doesn't fade in.

Subsequent edits: a bit of fit-and-finish work on my code (mostly for portability) :)

This looks really good James but there is a much easier way to do the fades and they are nice and smooth.

Go to my site and in the Left menu, select Code>>My Extra Udfs>>Dialog.au3. About halway throuth the udf you will find a fade function for fade in or fade out.

My Website

Example usage (if you saved the dialog.au3 file to your include folder):

#Include <dialog.au3>
$Frm_Main = GUICreate("Test Fade functions window")
_GUI_Fade($Frm_Main);; Fade in using a 2 second time period
GUISetState()
While 1
   If GUIGetMsg() = -3 Then
      _GUI_Fade($Frm_Main, 0, 3000);; Fade out using a 3 second time period
      Exit
   EndIf
Wend

If you are just going to use the function within your script then remove the #include line.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I've found that this moethod for fading in and out seems to work nicely.

FADE IN

WinSetTrans($YOURGUI, "", 0)

GUISetState(@SW_SHOW)

$t = 0

Do

WinSetTrans($YOURGUI, "", $t)

$t = $t + 1

Until $t = 255

FADE OUT

in your exit function,

$t = 254

Do

WinSetTrans($YOURGUI, "", $t)

$t = $t - 1

Until $t = 0

exit

And the background seems to work, but i'm using square corners, so don't know if the transparencey works.

Edited by l15ard

RichE

[font="'Arial Narrow';"]Current projects[/font]

[font="'Arial Narrow';"]are on my site [/font]Sellostring

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

@l15ard: If you read my post, you'll see that I tried using WinSetTrans() and it messes up the transparency. Also, that kind of a loop is perfectly set up for a For...To loop instead of a Do...Until loop.

For $i=0 To 255; fade in
    WinSetTrans($YOURGUI,$i)
Next

For $i=255 to 0 step -1; fade out
    WinSetTrans($YOURGUI,$i)
Next
Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
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
Sign in to follow this  
Followers 0