Sign in to follow this  
Followers 0
matrix200

Strange behavior of DrawString in GDIPlus

1 post in this topic

If you run those two examples separately you will see that the message font appears to be thicker where DrawString is called twice.

CODE

#include <GDIPlus.au3>

#include <GUIConstants.au3>

Global $hGraphic

Global $hWnd

Global $GUI,$GUI_Indicator

$GUI = GUICreate("WinNutClient", 640, 380, -1 , -1,Bitor($GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN))

$GUI_Indicator = GUICreate ("", 150, 120, 10, 10, BitOR ($WS_CHILD, $WS_DLGFRAME),$WS_EX_CLIENTEDGE,$GUI)

GuiSetState(@SW_SHOW,$GUI)

GuiSetState(@SW_SHOW,$GUI_Indicator)

_GDIPlus_Startup ()

$hWnd = WinGetHandle($GUI_Indicator)

$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)

_GDIPlus_GraphicsDrawString($hGraphic , "hello world",10,10)

_GDIPlus_GraphicsDrawString($hGraphic , "hello world",10,10)

Do

;Sleep(100)

Until GUIGetMsg() = $GUI_EVENT_CLOSE

_GDIPlus_Shutdown()

Exit

CODE

#include <GDIPlus.au3>

#include <GUIConstants.au3>

Global $hGraphic

Global $hWnd

Global $GUI,$GUI_Indicator

$GUI = GUICreate("WinNutClient", 640, 380, -1 , -1,Bitor($GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN))

$GUI_Indicator = GUICreate ("", 150, 120, 10, 10, BitOR ($WS_CHILD, $WS_DLGFRAME),$WS_EX_CLIENTEDGE,$GUI)

GuiSetState(@SW_SHOW,$GUI)

GuiSetState(@SW_SHOW,$GUI_Indicator)

_GDIPlus_Startup ()

$hWnd = WinGetHandle($GUI_Indicator)

$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)

_GDIPlus_GraphicsDrawString($hGraphic , "hello world",10,10)

Do

;Sleep(100)

Until GUIGetMsg() = $GUI_EVENT_CLOSE

_GDIPlus_Shutdown()

Exit

This is a problem if I use a WM_PAINT handler since window looks different after first repaint event.

Therefore I am forced to run the drawing twice in the beginning to make sure it doesn't change afterwards.

Could be a bug in GDIplus dll maybe?

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