Jump to content
Sign in to follow this  
taotao878

How to set text rendering hint ?

Recommended Posts

taotao878

#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!

Share this post


Link to post
Share on other sites
smashly

Hi,

I have no idea what the function does, but your missing the hwnd $hGraphic from the dll call.

$aResult = DllCall($ghGDIPDll, "int", "GdipSetTextRenderingHint", "hwnd", $hGraphic , "int", 2)

Cheers

Edit: should of been "hwnd" and not "int"

Edited by smashly

Share this post


Link to post
Share on other sites
rasim

If found this

I don`t know about second param, but seems this work:

$aResult = DllCall("GDIPlus.dll", "int", "GdipSetTextRenderingHint", "ptr", $hGraphic, "int", 2)
:)

Share this post


Link to post
Share on other sites
smashly

the reason I opted for "hwnd" over "ptr" or "int" was I looked through the GDIPlus.au3 udf.

just about all the functions that involve $hGraphic in a gdi call seem to use "hwnd"

Cheers

Share this post


Link to post
Share on other sites
rasim

smashly

Yes, you are right.

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.