Jump to content

Recommended Posts

Posted

Hello

My be I lack of information, but If I create a Graphic control via GUICtrlCreateGraphic the subsequent instructions gdi e.g _GDIPlus_GraphicsDrawRect are related to control and not on the windows indicated in _GDIPlus_GraphicsCreateFromHWND

Incidentally if this is correct is better for me.

thank

John Rossati

Posted

A graphic control created with GuiCtrlCreateGraphic is not intended to be usd with the _GDIPlus_* functions.. To draw on the graphic control you need to look up GuiCtrlSetGraphic.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

Hello Martin

yes this is true, but I checked the instructions _GDIPlus_GraphicsDrawRect draw a rectangle in the graphic control, instead of in the window.

Can be an Autoit error?

John Rossati

Posted (edited)

You can also draw with GDI+ into a picture control.

Example:

#include <gdiplus.au3>
#include <staticconstants.au3>

_GDIPlus_Startup()
$hGUI = GUICreate("Test", 320, 256)
GUISetBkColor(0x000000)
$iW = 120
$iH = 224
$idPic = GUICtrlCreatePic("", 80, 16, $iW, $iH, $SS_SUNKEN)
GUICtrlSetBkColor($idPic, 0xF0F0F0)
$hPic = GUICtrlGetHandle($idPic)
GUISetState()
$hGfx = _GDIPlus_GraphicsCreateFromHWND($hPic)
_GDIPlus_GraphicsClear($hGfx, 0xFFF0F0F0)
_GDIPlus_GraphicsSetSmoothingMode($hGfx, 2)
$hPen = _GDIPlus_PenCreate(0xFFFF0000)
_GDIPlus_GraphicsDrawLine($hGfx, 0, 0, $iW, $iH, $hPen)

Do
Until GUIGetMsg() = -3

_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGfx)
_GDIPlus_Shutdown()

Exit

GDI+ can only draw to a graphics handle or directly to a bitmap but not into a window handle.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

thank

This is a respons that I need, my errors was of thinking that the handle of _GDIPlus_GraphicsCreateFromHWND was the handle of a window (as saith in the help and in the example).

Jonh Rossati

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
×
×
  • Create New...