Jump to content

PNG as GUI, drop shadows, curved edges, you name it


lod3n
 Share

Recommended Posts

This is really cool, Someone really really Bored person should make an UDF for this

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

  • Replies 148
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I'm not bored...

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>


_GDIPlus_Startup()

$pngSrc = @ScriptDir & "\LaunchySkin.png"
    $GUI = _GUICreate_Alpha("Title", $pngSrc)
GUISetState()


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

_GDIPlus_Shutdown()


Func _GUICreate_Alpha($sTitle, $sPath, $iX=-1, $iY=-1, $iOpacity=255)
    Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    
    $hImage = _GDIPlus_ImageLoadFromFile($sPath)
    $width = _GDIPlus_ImageGetWidth($hImage)
    $height = _GDIPlus_ImageGetHeight($hImage)
    
    $hGUI = GUICreate($sTitle, $width, $height, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED)
    
    $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", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 2)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteObject($hImage)
    _WinAPI_DeleteDC($hMemDC)
EndFunc ;==>SetBitmap
Edited by Kip
Link to comment
Share on other sites

you get the dimensions twice

and just to be annoying...

$hImage = _GDIPlus_ImageLoadFromFile($sPath)

what does the h stand for in hImage? :) Sorry!

Edited by tic
Link to comment
Share on other sites

Ah I now see where your confusion lies. I looked into GDIPlus.au3 and see that it says:

Return values .: Success      - Handle to the new image object

wheras that is not true...

http://msdn.microsoft.com/en-us/library/ms534041(VS.85).aspx

GpStatus WINGDIPAPI GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image)

You can clearly see that it returns a gdi+ bitmap rather than a gdi bitmap, this being a pointer rather than a handle. So the return value is either

pBitmap or pImage :)

Just thought I'd share this as it appears every single person has written it incorrectly lol

Link to comment
Share on other sites

VERY nice. Would it be possible to do a transparent animation, like, an animated background?

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

  • 5 months later...
  • 1 month later...

Erm Hi,

How about you do something called READING THE FULL TOPIC.

You didn't even need to do that, you could just use this, which is on this page... :)

#533637

Cheers,

Brett

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Hi to all,

Is there a way to use "grey.gif" from the resources? I handled background pngs with zedna's udf but...

Thanks in advance

You won't need the grey.gif. Just set the Nackground color of the child GUI to the color you want to see transparent. Then use

_WinAPISetLayeredWindowAttributes to set this color transparent :P

You see, no GIF is needed.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

  • 5 months later...
  • 2 weeks later...
  • 10 months later...

Hi, a few things:

Firstly, well done, its great and exactly what I need but...

When I try to implement it the control GUI doesn't display?...

I think this is because I'm not using AdlibEnable() and AdlibDisable(), as they don't seem to work!

There's a file missing?

Please help, ASAP?

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