Code: Select all
#Include, Gdip.ahk
#SingleInstance, Force
SetBatchlines, -1
GDIP_StartUp()
gui, color, white
Gui, 1:+AlwaysOnTop
Gui, 1:Add, Picture, xm ym 0xE +BackgroundTrans hwndPicHwnd
Gui, 1:Add, Button, x100 y350 gagain, Earse and draw again
pBitmap := Gdip_CreateBitmap( 400 , 400)
G := Gdip_GraphicsFromImage( pBitmap )
Gui, 1:Show, w400 h400, Demo
return
again:
; what code is needed here or within the function to remove the red line (drawing) and draw again. I tried graphicsClear and some other methods but nothing worked for me
drawOne( PicHwnd , pBitmap, G)
return
drawOne( hwnd , pBitmap, G){
Gdip_SetSmoothingMode( G , 2 )
Pen := Gdip_CreatePen( "0xFFd50000" , 5 )
Gdip_DrawLine( G , Pen , 49, 49, 300, 175)
hBitmap := Gdip_CreateHBITMAPFromBitmap( pBitmap )
SetImage( hwnd , hBitmap )
; what code is added here that makes sense? I see some have Gdip_DeletePen( Pen ), DisposeImage etc?
}
GuiClose:
esc:
Gdip_Shutdown(pToken)
ExitApp