dost0011 Posted February 22, 2009 Posted February 22, 2009 Hi, I have no idea and can't find anything about a dashed line. is it possible to draw an dashed (or doted) line ? Many thanks!
bundyxc Posted February 22, 2009 Posted February 22, 2009 Well.. where are you trying to draw it? What should it be doing? Global $arr[2] $arr[0]="hip" $arr[1]="hip" ;^^ hip hip array. ^^
dost0011 Posted February 22, 2009 Author Posted February 22, 2009 Well.. where are you trying to draw it?What should it be doing?Hi,at the moment I draw Lines by: GUICtrlSetGraphic(-1, $GUI_GR_MOVE, x1,y1) GUICtrlSetGraphic(-1, $GUI_GR_LINE, x2, y2)And now would like to dash the lines...Do you have any idea ?thanks.
Malkey Posted February 23, 2009 Posted February 23, 2009 Hi, I have no idea and can't find anything about a dashed line. is it possible to draw an dashed (or doted) line ? Many thanks!Using _GDIPlus_PenSetDashStyle() function is one way of drawing dot or dash lines by changing the $iStyle parameter. The _GDIPlus_SetPenDashArray (() function/wrapper uses the GdipSetPenDashArray function from the gdiplus.dll file. By using this wrapper, custom style lines can be created. You may find this difficult to implement. But there are a lot of GDI+ examples on the forums and in the help file. This is a modified example from the help file. expandcollapse popup#include <guiconstantsex.au3> #include <gdiplus.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $hGUI, $hGraphic, $hPen ; Create GUI $hGUI = GUICreate("GDI+", 600, 300) GUISetState() ; Create resources _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Colour format uses is hexidecimal 0xAARRGGBB - Alpha, Red, Green, Blue $hPen = _GDIPlus_PenCreate(0xFF800080, 8); ; Draw Dash line _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASH ) _GDIPlus_GraphicsDrawLine($hGraphic, 10, 120, 590, 120, $hPen) ; Draw customized line ; 5.0f, // dash length 5 ; 2.0f, // space length 2 ;15.0f, // dash length 15 ; 1.0f, // space length 4 Local $aPattern[4] = [5.0, 2.0, 15.0, 4.0] _GDIPlus_SetPenDashArray($hPen, $aPattern) _GDIPlus_GraphicsDrawLine($hGraphic, 10, 150, 590, 150, $hPen) ; Draw dotted line _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDOT ) _GDIPlus_GraphicsDrawLine($hGraphic, 10, 180, 590, 180, $hPen) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>_Main ; GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, INT count) Func _GDIPlus_SetPenDashArray($hPen, $aPattern) Local $aRet, $iCount, $tPattern, $pPattern $iCount = UBound($aPattern) $tPattern = DllStructCreate("float[" & $iCount & "]") $pPattern = DllStructGetPtr($tPattern) For $iI = 1 To $iCount DllStructSetData($tPattern, 1, $aPattern[$iI - 1], $iI) Next $aRet = DllCall($ghGDIPDll, "int", "GdipSetPenDashArray", "hwnd", $hPen, _ "ptr", $pPattern, "int", $iCount) Return EndFunc ;==>_GDIPlus_SetPenDashArray
YellowLab Posted May 18, 2009 Posted May 18, 2009 I saw you post and was in the middle of working on a solution.Check out the non-GDIP solution here:http://www.autoitscript.com/forum/index.php?showtopic=95240Bob You can't see a rainbow without first experiencing the rain.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now