Phantomasss Posted June 19, 2009 Share Posted June 19, 2009 Hello. Sorry me, but i need an example...Necessary to add a simple .png image in a GUI window with the use of GDI+.Images:Result:Thanks! Link to comment Share on other sites More sharing options...
Andreik Posted June 19, 2009 Share Posted June 19, 2009 Hello. Sorry me, but i need an example... Necessary to add a simple .png image in a GUI window with the use of GDI+. Images: Result: Thanks!Hope that help you. #include <GDIPlus.au3> _GDIPlus_Startup() Global $Image1 = _GDIPlus_ImageLoadFromFile("png1.png") Global $Image2 = _GDIPlus_ImageLoadFromFile("png2.png") $GUI = GUICreate("Example",200,200) GUISetState() Global $Graphic = _GDIPlus_GraphicsCreateFromHWND($GUI) _GDIPlus_GraphicsDrawImageRect($Graphic, $Image1,25,25,100,100) _GDIPlus_GraphicsDrawImageRect($Graphic, $Image2,75,75,100,100) While 1 $MSG = GUIGetMsg() Switch $MSG Case -3 Quit() EndSwitch WEnd Func Quit() _GDIPlus_ImageDispose($Image1) _GDIPlus_ImageDispose($Image2) _GDIPlus_GraphicsDispose($Graphic) _GDIPlus_Shutdown() Exit EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Zedna Posted June 20, 2009 Share Posted June 20, 2009 Here is modified version using WM_PAINT to avoid lost image after hidding by another application expandcollapse popup#include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> _GDIPlus_Startup() Global $Image1 = _GDIPlus_ImageLoadFromFile("png1.png") Global $Image2 = _GDIPlus_ImageLoadFromFile("png2.png") $GUI = GUICreate("Example",200,200) Global $Graphic = _GDIPlus_GraphicsCreateFromHWND($GUI) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") GUISetState() While 1 $MSG = GUIGetMsg() Switch $MSG Case -3 Quit() EndSwitch WEnd Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam) _WinAPI_RedrawWindow($GUI, 0, 0, $RDW_UPDATENOW) ; force redraw of GUI (Rect=0 Region=0) ; then draw my stuff on top _GDIPlus_GraphicsDrawImageRect($Graphic, $Image1,25,25,100,100) _GDIPlus_GraphicsDrawImageRect($Graphic, $Image2,75,75,100,100) _WinAPI_RedrawWindow($GUI, 0, 0, $RDW_VALIDATE) ; then force no-redraw of GUI Return $GUI_RUNDEFMSG EndFunc Func Quit() _GDIPlus_ImageDispose($Image1) _GDIPlus_ImageDispose($Image2) _GDIPlus_GraphicsDispose($Graphic) _GDIPlus_Shutdown() Exit EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Yashied Posted June 20, 2009 Share Posted June 20, 2009 #Include <Icons.au3> Global Const $sPng = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\Examples\GUI\Advanced\Images\Torus.png' $Form = GUICreate('Test', 253, 244) $Pic1 = GUICtrlCreatePic('', 10, 10, 193, 184) $Pic2 = GUICtrlCreatePic('', 60, 60, 193, 184) GUISetState() _SetImage($Pic2, $sPng) _SetImage($Pic1, $sPng) Do Until GUIGetMsg() = -3Icons.au3 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now