Schéma technique avec GDIP ?

Poser vos questions de programmation en AutoHotkey
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Schéma technique avec GDIP ?

15 Oct 2017, 07:13

Bonjour,

Je souhaiterai généré à partir d'information un schéma technique dans un GUI. (Voir image, pour un exemple)

Actuellement je réfléchi comme je pourrai faire, en utilisant (Gui, Add, Picture, ) mais c'est pas top ...

J'aimerai avoir un rendu plus propre en vectoriel ou comme j'ai vu avec GDIP. Je n'arrive pas à utiliser GDIP, j'ai trouvé d'une version de 2011 qui ne fonctionne pas (j'ai vu sur youtube un tuto sur GDIP mais cela ne fonctionne pas chez moi)

Avez-vous une autre idée ? ou pouvez-vous m'apporter une aide avec GDIP ?

Merci d'avance

ScreenShot :
Spoiler
Last edited by ScottMeyer on 21 Oct 2017, 08:53, edited 1 time in total.
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

15 Oct 2017, 11:33

La nouvelle version de Gdip se retrouve ici: https://autohotkey.com/boards/viewtopic.php?t=6517
Sur cette page il y a plusieurs exemples qui pourra te donner une meillleur idee.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

15 Oct 2017, 13:23

Merci joedf, de ta réponse.

Cependant que je le disais chez moi les exemples GDIP ne fonctione pas.
J'ai windows 64 bits 7 home, j'ai dans le même répertorie le fichier GDIP.AHK + Gdip.Tutorial.1-Draw.Shapes.ahk ( j'ai mis aussi GDIP.AHK dans C:\Users\Scotty\Documents\Autohotkey\Lib )
Quand je lance le fichier Gdip.Tutorial.1-Draw.Shapes.ahk, je le vois bien dans le systray mais rien d'autre pas de Gui ni graphique ...

Connais tu le problème que je rencontre ?

J'ai pris sur le forum :
AUTOHOTFLOW <- dans sa version en fichier EXE, il fonctionne mais en fichier AHK (non compilé) il ne fonctionne pas (le gui se lance mais l'emplacement réserver à GDIP est vide). J'ai bien vérifier #Include manager\gdip.ahk est là (le fichier aussi).

particles_class.ahk <- c'est une piste intéressante

Surtout que dans la description l'auteur indique que ce script peut faire ce que je recherche.
Description:
Add a particle system to your script! Lines, circles, connected lines, and much more types!
Control the speed, angle, jitter and many more properties. Values are transitioned smoothly if more than 1
value is specified.

- L'avantage c'est qu'il n'utilise pas GDIP car chez moi ça ne fonctionne pas.
- Il y a 3 exemples : demo3_Fullscreen_Mouse.ahk + demo2_Draw_On_GUI.ahk + demo1_Draw_Over_Buttons.ahk Mais ils sont compliqués pour moi.
- Je souhaiterai simplement tirer un trait + faire un rond + rectangle

Merci beaucoup de toute aide, et si j'ai une explication simple je suis sûr qu'elle sera très profitable aux autres car je pense que particles_class.ahk peut faire bien plus ! :D
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

15 Oct 2017, 15:44

Entre temps j'ai fouillé GitHub et j'ai trouvé Gdip2 : https://github.com/tariqporter/Gdip2

Qui fonctionne a merveille sur mon PC :superhappy: avec des exemples simple

Maintenant reste à les exploiter ;) je reviendrais pour poster du code et demandez certainement de l'aide .

Du coup je suis toujours preneur de conseils , GDIP2 vs Particles_Class ???
Lequel le meilleur pour faire des plans technique ?
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

16 Oct 2017, 19:38

Oh! tres bien :+1:
Gdip2 n'est pas encore "complet" ,je suis pas certain. mais bon :)

Particles_class? Tu veux ca? https://github.com/acorns/Particle-System
:think:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

20 Oct 2017, 07:19

Bonjour,

Oui GDip2 , même si il n'est pas complet et si il ne plante pas
il fait des choses simple comme mes besoins le demande, ça me vas 8-)

Sinon Oui Particule class https://github.com/acorns/Particle-System
Je pense qu'il peut faire ce que je demande.
Par contre ce type de code n'es pas conventionnel par rapport au language AHK, et j'ai un peu de mal :oops:
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

21 Oct 2017, 00:19

Cest pour creer des effets flashs, me semble que ca sera pas tres pratique pour des schemas non?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

21 Oct 2017, 03:53

En faite on peut faire juste apparaître un graphique sans mouvement (et sans flash) . J'ai fait tellement de test que je suis un peu perdu. Je croyais que Particules_Class n'utilisait pas GDI mais en faite si :problem:

Donc es ce que ça peut m'arranger ou complexifier la chose ???

Test Particules Class + GDI sans mouvement :

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
; #singleInstance, off
#singleInstance, force
setBatchLines, -1
#include %A_ScriptDir%\Gdip.ahk
#include %A_ScriptDir%\particles_class.ahk

gui, add, picture, w400 h400 0xE hwndPHWND				; this control is what we draw onto. give it an HWND (i named it "PHWND") so we can draw onto it.
gui show, w300 h300 autosize
Gui +LastFound + Resize


pToken:=Gdip_Startup()									; Start gdi+, this is required.

; create a system that runs at 30 fps
psys:=new particles(100)

; create a display/canvas using the dimensions of the picture control "PHWND"
; set the quality to 4, which is the best but slowest (1-4) 
psys.setCanvas(0, 0, 0, 0, 4, PHWND)

; add an emitter, this is what stores all the info of how a particle should behave
; if unset, it uses the default values
e1:=psys.addEmitter()  ; create the emitter, save its pointer as "e1" for easy access 
e1.type:="text"        ; how it displays
e1.circleSize:=[22] ; at the start of its life, it'll be size 22 text, at the end, 18
e1.color:=["000000"]   ; what color(s) it'll be
e1.LineWidth:=[5, 1] ; transition from 5 to 1 pixels over its life
psys.addParticle(50, 50, 1, "O1_O2")
psys.addParticle(70, 70, 1, "ABC")
psys.draw(PHWND) ; finally, draw it onto the gui.

http://atelierludique.free.fr/000/UPLOA ... _class.zip
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

21 Oct 2017, 10:47

En fait, jpense que ça serait mieux de juste utiliser gdip sans particles class/system.
C'est plutôt pour des trucs animés/d'animations.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

21 Oct 2017, 10:59

Salut,

Pourrais-tu s'il te plait me faire un petit script avec GDIP2
avec un trait + un rond + un rectangle + du texte ? avec des couleurs différents :oops:
Ca m'aiderai beaucoup je m'en servirais comme exemple et ça évitera que je fasse un code pas propre :D
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

21 Oct 2017, 17:55

Question supplémentaire,

Peut-on écrire du texte verticalement simplement ?

Exemple :
Image

Merci
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

21 Oct 2017, 20:53

Cette example devrais demontrer la base que tu aura besoin.
Mais cela utilise Gdip v1.45: https://raw.githubusercontent.com/acorn ... r/Gdip.ahk
Gdip v2 n'a pas encore les fonctions de rotation, et particle class fonctionne avec v1.45 seulement.
Je n'ai pas beaucoup d'experience avec gdip. Je sais comment ca fonctionne en principle, mais j'en ai pas encore eu besoin.

Code: Select all

;modified example by joedf
#SingleInstance, Force
#NoEnv
SetBatchLines, -1

; Uncomment if Gdip.ahk is not in your standard library
#Include, Gdip.ahk

; Start gdi+
If !pToken := Gdip_Startup()
{
	MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
	ExitApp
}
OnExit, Exit

; Set the width and height we want as our drawing area, to draw everything in. This will be the dimensions of our bitmap
Width :=300, Height := 200

; Create a layered window (+E0x80000 : must be used for UpdateLayeredWindow to work!) that is always on top (+AlwaysOnTop), has no taskbar entry or caption
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA ; Show the window
hwnd1 := WinExist() ; Get a handle to this window we have created in order to update it later


pBitmap := Gdip_CreateBitmap(Width, Height)
G := Gdip_GraphicsFromImage(pBitmap)
Gdip_SetSmoothingMode(G, 4) ;anti-alias


OriginalWidth := Width
OriginalHeight := Height



;draw stuff
pBrushGrey := Gdip_BrushCreateSolid(0xffdfdfdf)
pBrushRed := Gdip_BrushCreateSolid(0xffff0000)
pPenBlue := Gdip_CreatePen(0xff0000ff, 10)
pPenGreen := Gdip_CreatePen(0xff00ff00, 10)
Gdip_FillRectangle(G, pBrushGrey, 0, 0, OriginalWidth, OriginalHeight)
Gdip_FillEllipse(G, pBrushRed, 50, 50, OriginalWidth-100, OriginalHeight-100)
Gdip_DrawRectangle(G, pPenBlue, 0, 0, OriginalWidth, OriginalHeight)
Gdip_DrawLine(G, pPenGreen, 0, 0, OriginalWidth, OriginalHeight)
Gdip_TextToGraphics(G, "This is the y label", "x20 y20 cff000000 s18 r4")



Angle := 270


Gdip_GetRotatedDimensions(Width, Height, Angle, RWidth, RHeight)
Gdip_GetRotatedTranslation(Width, Height, Angle, xTranslation, yTranslation)

;MsgBox [%RWidth%,%RHeight%,%xTranslation%,%yTranslation%]

hbm := CreateDIBSection(RWidth, RHeight)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc), Gdip_SetInterpolationMode(G, 7)

Gdip_TranslateWorldTransform(G, xTranslation, yTranslation)
Gdip_RotateWorldTransform(G, Angle)

Gdip_DrawImage(G, pBitmap, 0, 0, Width, Height, 0, 0, OriginalWidth, OriginalHeight)
Gdip_ResetWorldTransform(G)

*/

; Delete the brush/pen as it is no longer needed and wastes memory
Gdip_DeleteBrush(pBrushGrey)
Gdip_DeletePen(pPenBlue)


UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth-RWidth)//2, (A_ScreenHeight-RHeight)//2, RWidth, RHeight)

OnMessage(0x201, "WM_LBUTTONDOWN")


SelectObject(hdc, obm) ; Select the object back into the hdc
DeleteObject(hbm) ; Now the bitmap may be deleted
DeleteDC(hdc) ; Also the device context related to the bitmap may be deleted
Gdip_DeleteGraphics(G) ; The graphics may now be deleted
Return


;#######################################################################

; This function is called every time the user clicks on the gui
; The PostMessage will act on the last found window (this being the gui that launched the subroutine, hence the last parameter not being needed)
WM_LBUTTONDOWN()
{
	PostMessage, 0xA1, 2
}

;#######################################################################

;#######################################################################

Exit:
; gdi+ may now be shutdown on exiting the program
Gdip_Shutdown(pToken)
ExitApp
Return

Esc::
goto Exit
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

21 Oct 2017, 21:05

Jai un autre example que jai modifier un peu qui demontre la rotation par une methode plus simpliste.

Code: Select all

;modified from https://autohotkey.com/board/topic/99796-gdip-draw-rotated-text-onto-an-image/#entry625679
;test by joedf
#Include gdip.ahk

If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}
OnExit, Exit
Width := A_ScreenWidth, Height := A_ScreenHeight
Gui, 1: -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop
Gui, 1: Show, NA
hwnd1 := WinExist()
hbm := CreateDIBSection(Width, Height)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(G, 4)

pPen_plot_lines := Gdip_CreatePen(0xff000000, 2)
pPen_area := Gdip_CreatePen(0xffcccccc, 2)

pPen_BlueLine := Gdip_CreatePen(0xff0000ff, 2)

pBrush_area_fill := Gdip_BrushCreateSolid(0xffffffff)
Gdip_FillRectangle(G, pBrush_area_fill, 50, 50, 550, 550)
Gdip_DrawRectangle(G, pPen_area, 49, 49, 551, 551)


Gdip_DrawLine(G, pPen_BlueLine, 200, 500, 500, 200)

Gdip_DrawLine(G, pPen_plot_lines, 200, 500, 500, 500)
Gdip_DrawLine(G, pPen_plot_lines, 200, 500, 200, 200)

Options = x270 y520 cff000000 s18 r4
Gdip_TextToGraphics(G, "This is the x label", Options)
Options = x270 y550 cff000000 s18 r4




rc:=Gdip_TextToGraphics(G, "This is the y label", Options,,,,1)
;x = RC1, y = RC2, width = RC3, height = RC4, number of characters = RC5, number of lines = RC6
StringSplit, rc,rc,|

pBitmap2:=Gdip_CreateBitmap(rc3,rc4)
pGraphics :=Gdip_GraphicsFromImage(pBitmap2)
Gdip_GraphicsClear(pGraphics, 0xffffffff)      ;easier than using brush to fill 

Options = x0 y0 cff000000 s18 r4
rc:=Gdip_TextToGraphics(pGraphics, "This is the y label", Options)
Gdip_ImageRotateFlip(pBitmap2, 3)
Gdip_DrawImage(G, pBitmap2, 170,240, rc4, rc3)

UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height) ;show all of that stuff we just did
return
Exit:
Gdip_DeletePen(pPen_area)
Gdip_DeletePen(pPen_plot_lines)
Gdip_DeleteBrush(pBrush_area_fill)
SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
Gdip_DisposeImage(pBitmap)
Gdip_DisposeImage(pBitmap2)
Gdip_DeleteGraphics(pGraphics)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)
ExitApp
Return
Esc::ExitApp
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

22 Oct 2017, 09:49

Bonjour joedf,

Oh ! Merci pour les exemples, ça aide beaucoup.

Il n'est pas possible de faire apparaître la fenêtre autour ? quand je mets " +Caption " tout disparait ...
Sinon il faudrait faire apparaît cette objet flottant au dessus d'un Gui classique et s'assurer qu'il suit la fenêtre classique hum ...

Sans parler de GDIP ou autre, est-il possible de faire du texte à la verticale ?
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

22 Oct 2017, 15:00

mais oui, deuxieme exemple?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

22 Oct 2017, 17:17

Salut,

J'avoue c'est compliqué GDIP, certainement que j'y arriverai avec du temps et beaucoup de tests (je n'abandonne pas cet idée)
Cependant dans l'immédiat j'opte plutôt pour une solution que je maîtrise mieux, plus simple pour que mon projet aboutisse après on verra pour le rendre beau.

Voilà ce que j'ai fait dis moi ce que tu en penses :D

Image

Code: Select all

#Include %A_ScriptDir%\Class_CtlColors.ahk

EXT  = 13
INT := EXT - 4 

Gui, 1:Color, EEAA99
Gui, 1:+AlwaysOnTop +Resize ; +LastFound
; Gui, Margin, 10, 10

; DEBUT
Gui, 1:Add, Text		, x0 		y0		w70 	center	hwndCouleur						,NOM
							CtlColors.Change(Couleur, "FFFF00", "000000")	
Gui, 1:Add, Text		, x70 		y0		w60 			Right	-Background				,Position
Gui, 1:Add, Text		, x135 		y0		w%EXT% 	h%EXT%  hwndCouleur   					; CARRE EXTERIEUR
							CtlColors.Change(Couleur, "0000FF", "000000")	
Gui, 1:Add, Text		, xp+2  	yp+2  	w%INT%  h%INT%  hwndCouleur  					; CARRE INTERIEUR
							CtlColors.Change(Couleur, "FFFFFF", "000000")	
; LIGNES
Gui, 1:Add, Text		, xp+11		yp+3 	w100	h4		hwndCouleur		vW_Largeur_Max	; LIGNE 1						,
							CtlColors.Change(Couleur, "000000", "000000")	
	
; FIN
Gui, 1:Add, Text		, X0 		y0		w%EXT% 	h%EXT%  hwndCouleur 	vX_Last_EXT		; CARRE EXTERIEUR
							CtlColors.Change(Couleur, "FF0000", "000000")	
Gui, 1:Add, Text		, xp+2  	yp+2  	w%INT%  h%INT%  hwndCouleur		vX_Last_INT		; CARRE INTERIEUR
							CtlColors.Change(Couleur, "FFFFFF", "000000")
Gui, 1:Add, Text		,  			y0		w60 	Left	-Background		vX_Last2		,Position
Gui, 1:Add, Text		,  			y0		w70 	center	hwndCouleur		vX_Last1		,NOM
							CtlColors.Change(Couleur, "FFFF00", "000000")	

; TESTS ECRITURE VERTICALE
Gui, 1:Add, Text		, X170 		y20		w10	 	center	hwndCouleur						,0`n1`n6`nà`n0`n1`n7
							CtlColors.Change(Couleur, "A9F5A9", "000000")	

Gui, 1:Show				, xCenter y90 	w400 h140											, GUI REDIMENSIONNABLE 
Return

guisize:
GuiControl			, 1:move	, X_Last1			, % "x"A_GuiWidth - 70 
GuiControl			, 1:move	, X_Last2			, % "x"A_GuiWidth - 70 - 60
GuiControl			, 1:move	, X_Last_EXT		, % "x"A_GuiWidth - 70 - 60 - 13 - 5
GuiControl			, 1:move	, X_Last_INT		, % "x"A_GuiWidth - 70 - 60 - 13 - 3
GuiControl			, 1:move	, W_Largeur_Max		, % "w"(A_GuiWidth - 146 - 149) 
WinSet				, Redraw	,
Return

F11::
; CtlColors.Attach(Couleur, "000000", "FFFFFF")
CtlColors.Change(Couleur, "0000FF", "FFFFFF")
; CtlColors.Detach(Couleur)
Return

F12::Reload

Close:
CtlColors.Detach(Couleur)
ExitApp
Fichier AHK + Function CtrlColor => http://atelierludique.free.fr/000/UPLOA ... HNIQUE.zip
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

22 Oct 2017, 21:26

Pas de problèmes :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: Schéma technique avec GDIP ?

25 Oct 2017, 06:00

Bonjour,
Tu peux essayer ça. ;)
canvas.ahk by Uberi
https://github.com/Uberi/Canvas-AHK


Voici un example:

Code: Select all

;https://github.com/Uberi/Canvas-AHK

#include canvas.ahk

s := new Canvas.Surface(400,400)      ;create a new drawing area

s.Clear(0xFFA0A0A0)                   ;change la couleur du fond en gris

s.Smooth := "Best"                    ;antialiasing (améliore la qualité de l'image) .Smooth := "None" "Good" or "Best"

Gui, +LastFound
v := new Canvas.Viewport(WinExist()).Attach(s)

crayon_rouge := new Canvas.Pen(0xFFFF0000,1)
crayon_vert := new Canvas.Pen(0xFF00FF00,1)
crayon_jaune := new Canvas.Pen(0x80FFFF00,2)
b := new Canvas.Brush(0xAAFF00FF)



f := new Canvas.Font("arial",18)
s.Text(new Canvas.Brush(0xaaFFFFFF),f,"test `nde dessin",300,200)       ;Text(Brush,Font,Value,X,Y,W = "",H = "")


gui, +resize
Gui, Show, x10 y10 w400 h400, Canvas Demo

gosub, space
Return

GuiClose:
ExitApp

space:
s.DrawRectangle(crayon_jaune,30,80,300,50)                   ;DrawRectangle(pen,posx,posy,Width,Height)
s.FillRectangle(b,50,50,50,50)                               ;FillRectangle(brush,posx,posy,Width,Height) 
s.DrawEllipse(crayon_jaune,150,150,50,100)                   ;DrawEllipse(pen,posx,posy,Width,Height)
s.Line(crayon_vert,15,20,300,300)                            ;draw a line .Line(Pen,x1,y1,x2,y2)

PointArray:=[[30,200],[30,300],[100,300]]                    ;set an array of points for the polygon [[X1,Y1],[X2,Y2],[X3,Y3]]
s.DrawPolygon(crayon_rouge,PointArray)                       ;draw a polygon (triangle)

v.Refresh()
Return



Last edited by SpeedMaster on 26 Oct 2017, 06:02, edited 1 time in total.
User avatar
ScottMeyer
Posts: 33
Joined: 27 Sep 2017, 12:52
Contact:

Re: Schéma technique avec GDIP ?

25 Oct 2017, 07:17

Excellent ! Merci de l'info Speed Master :D

Gros avantage le dessin est un élément du Gui et positionnable dans ce dernier.
Il est moins beau que GDIP mais j'ai pas regardé pour l'instant on peut certainement augmenter la résolution (cleartype, dpi,...) en tout cas cela m'intéresse beaucoup.

Merci
JEE (jeeswg) "Better WinGetPos" : LIEN Forum AHK
AHK Vision Go : LIEN Forum AHK
Simply Backup Script : LIEN Forum AHK
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Schéma technique avec GDIP ?

26 Oct 2017, 00:13

Totally forgot about that. Thanks for sharing SpeedMaster! :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “J'ai besoin d'aide”

Who is online

Users browsing this forum: No registered users and 23 guests