Jump to content
Sign in to follow this  

How to improve it?

Recommended Posts


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

Global $hBitmap, $hImage, $hGraphic, $hFamily, $hFont, $tLayout, $hFormat, $aInfo, $hBrush
Global $img, $img2, $text, $textx, $texty, $fontsize, $pic

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 508, 245, 270, 524)
$Pic1 = GUICtrlCreatePic("", 24, 56, 401, 153, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Load = GUICtrlCreateButton("Load an image", 304, 16, 161, 25, $WS_GROUP)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Load
            addtext(@ScriptDir & "\0.jpg", @ScriptDir & "\1.jpg", "text1", 10, 8, 16, $Pic1)
            addtext(@ScriptDir & "\1.jpg", @ScriptDir & "\2.jpg", "text2", 90, 5, 10, $Pic1)

Func addtext($img, $img2, $text, $textx, $texty, $fontsize, $pic)

$hImage   = _GDIPlus_ImageLoadFromFile($img)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, $fontsize, 1)
$tLayout = _GDIPlus_RectFCreate ($textx, $texty, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $text, $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $text, $hFont, $aInfo[0], $hFormat, $hBrush)
_GDIPlus_ImageSaveToFile($hImage, $img2)
GUICtrlSetImage($pic, $img2)


How to add two or more texts by ONE File_Save?


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.