Sign in to follow this  
Followers 0
ChrisL

GDIPLUS Draw on a Control

3 posts in this topic

When using GDIPLUS can you draw to a control rather than a GUI HWND?

All of the examples I have seen draw in to a single GUI HWND.

I want to create a contact sheet on screen like the attached image, I am guessing that drawing each cell is the best way to do it with GDIPlus, but do I have to draw to the GUI HWND or could I make a grid of label or button controls and draw to each control, or would I make a series of child GUI's and draw to each of those?

I tried $Label = GuiCtrlCreateLabel() and $hWND = GuiCtrlGetHandle($Label) but without success.

Thanks

Chris

post-7154-12808738075481_thumb.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Sure, just do the usual (with the handle from GUICtrlGetHandle).

Quick example:

#Include <GDIPlus.au3>

_GDIPlus_Startup()

GUICreate("test", 640, 480)
GUISetState()
GUICtrlCreateLabel("", 100, 100, 200, 100)
$Handle = GUICtrlGetHandle(-1)

$graphics = _GDIPlus_GraphicsCreateFromHWND($Handle)
_GDIPlus_GraphicsDrawString($graphics, "hello from Label", 5, 5)

Do
Until GUIGetMsg() = -3   ;$GUI_EVENT_CLOSE

_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()

I want to create a contact sheet on screen like the attached image, I am guessing that drawing each cell is the best way to do it with GDIPlus, but do I have to draw to the GUI HWND or could I make a grid of label or button controls and draw to each control, or would I make a series of child GUI's and draw to each of those?

Doesn't really matter I would say, but the last one sounds complex. Just use whatever you are most comfortable with.

Me myself, I probably wouldn't use GDI+ at all, but that's me. :blink:

Edit: 2 more sentences.

Edited by AdmiralAlkex

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