Sign in to follow this  
Followers 0
MerkurAlex

save a string as a bmp

4 posts in this topic

I assume it is possible to save a string as a bmp but i cannot figure it out i was thinking something with gdiplus but i cannot even get the stringdraw example to work it worked ONE time then i tried again and the same code will no longer draw a string can anyone help.


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites



I assume it is possible to save a string as a bmp but i cannot figure it out i was thinking something with gdiplus but i cannot even get the stringdraw example to work it worked ONE time then i tried again and the same code will no longer draw a string can anyone help.

Do some forum searching on how to create and save a bitmap with GDI.

Here is my 'Help file' on the DrawString. Does it not work for you?

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

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hGUI, $hWnd, $hGraphic

    ; Create GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    $hWnd = WinGetHandle("GDI+")
    GUISetState()

    ; Draw a string
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    _GDIPlus_GraphicsDrawString ($hGraphic, "Hello world", 140, 110)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_Shutdown ()

EndFunc   ;==>_Main

Share this post


Link to post
Share on other sites

If the text exists in a DC you can use selectobj or some shit to get it into an hbitmap ... to create text DC perhaps search the forum for CreateTextRgn

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

If you're trying to do this on the fly... something like:

CreateCompatibleDC

CreateBitmap

TextOut or DrawText

Would probably work.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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