
taotao878
Active Members-
Posts
28 -
Joined
-
Last visited
taotao878's Achievements

Seeker (1/7)
0
Reputation
-
#include <WindowsConstants.au3> #include <GDIPlus.au3> #include <GUIConstants.au3> #Include <WinAPI.au3> _GDIPlus_Startup () $GUI = GUICreate("WinNutClient", 640, 380, -1 , -1,Bitor($GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN)) GuiSetState(@SW_SHOW,$GUI) $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($GUI) _GDIPlus_SetTextRenderingHint() _GDIPlus_GraphicsDrawString($hGraphic, "hello world",10,10, "Arial", 50) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_Shutdown () Func _GDIPlus_SetTextRenderingHint() Local $aResult $aResult = DllCall($ghGDIPDll, "int", "GdipSetTextRenderingHint", "int", 2) Return $aResult EndFunc ;==>_GDIPlus_SetTextRenderingHint The above code is unsuccessful. How to do it ? Thanks!
-
#include <GuiConstantsEX.au3> #include <GDIPlus.au3> #include "resources.au3" _GDIPlus_Startup() $hGui = GUICreate("show png", 350, 300) $hPic = GUICtrlCreatePic("", 25, 25, 300, 200) $Button = GUICtrlCreateButton("view", 130, 250, 75, 21) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button $OpenFile = FileOpenDialog("Select image file", "", "image(*.png)") _GUICtrlStatic_SetPicture($OpenFile, $hPic) EndSwitch WEnd FUnc _GUICtrlStatic_SetPicture($File, $CtrlId) $hImage = _GDIPlus_ImageLoadFromFile($File) $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) GUICtrlSetImage($CtrlId, "") _SetBitmapToCtrl($CtrlId, $hBitmap) EndFUnc
-
-
#include <GuiConstantsEX.au3> #include <GDIPlus.au3> Global $hGui, $iExt Global $hPic, $hImage, $hGraphic $hGui = GUICreate("show png", 350, 300) $Button = GUICtrlCreateButton ("view", 270, 270, 75, 21) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button $OpenFile = FileOpenDialog("Select png file", "", "png(*.png)") _GDIPlus_StartUp() $hImage = _GDIPlus_ImageLoadFromFile($OpenFile) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") EndSwitch WEnd _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_ShutDown() Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc It have problem to show png with GDI+, likes attachment
-
#include <GUIConstants.au3> #include <GDIPlus.au3> #Include <WinAPI.au3> Opt("MustDeclareVars", 1) Global $hGUI, $hImage, $hGraphic, $hImage1 ; Create GUI $hGUI = GUICreate("Show PNG", 260, 260) GUISetState() ; Load PNG image _GDIPlus_StartUp() $hImage = _GDIPlus_ImageLoadFromFile("MAIN.png") ; Draw PNG image $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 50, 50) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") ; Loop until user exits do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_ShutDown() Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 50, 50) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc
-
I found a png (1101) from Resource.dll that I want in my GUI but I don't know how to put it into my GUI. Is it possible to use the png without making a picture of it?
-
Setting PNG file to an image pic Control?
taotao878 replied to nobbe's topic in AutoIt GUI Help and Support
Thanks jpam. I thought that it should also be possible to realize with API and GDI+. but i cann't do it. -
Setting PNG file to an image pic Control?
taotao878 replied to nobbe's topic in AutoIt GUI Help and Support
This script probably does not have an effect -
Setting PNG file to an image pic Control?
taotao878 replied to nobbe's topic in AutoIt GUI Help and Support
The above script cannot minimize,Otherwise dosen't display image -
Setting PNG file to an image pic Control?
taotao878 replied to nobbe's topic in AutoIt GUI Help and Support
but this script isn't transparent -
I think au3 isn't fully to support aRGB bmp format.
-
I think this is a bug also. But nobody see this topic.
-
-
-
1. please run this script in Win XPsp2 2. please run this script in Win 2003 The result of 1 is different from the result of 2. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 2) Global $n = 0 Global $MousePos = True Global $Last $mainwindow = GUICreate("test", 220, 220) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetOnEvent($GUI_EVENT_PRIMARYUP, '_PRIMARYup') GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "MouseOver") $Previewimage = GUICtrlCreatePic("act_rs.bmp", 20, 20, 92, 46) GUICtrlSetCursor($Previewimage, 0) GUISetState(@SW_SHOW) While 1 Sleep(1000) WEnd Func _Exit() Exit EndFunc Func _PRIMARYup() If $MousePos Then If $n = 2 Then $n = 0 Else $start = TimerInit() EndIf EndIf $GGCI = GUIGetCursorInfo($mainwindow) If $GGCI[4] = $Previewimage Then msgbox(0,"test","Very beauty!") EndFunc Func MouseOver() $GGCI = GUIGetCursorInfo($mainwindow) If $GGCI[4] = $Previewimage And $Last <> $Previewimage Then GUICtrlsetimage($Previewimage, "") GUICtrlsetimage($Previewimage, "act_rs1.bmp") GuiCtrlSetCursor($Previewimage, 0) $Last = $Previewimage ElseIf $GGCI[4] <> $Previewimage And $Last = $Previewimage Then GUICtrlsetimage($Previewimage, "") GUICtrlsetimage($Previewimage, "act_rs.bmp") $Last = 0 EndIf EndFunc The attached files are 32bit ARGB format BMP (with alpha channel) act_rs1.bmp act_rs.bmp