BrettF Posted September 28, 2008 Posted September 28, 2008 More unchartered teritory now. Now I just need to draw lines with GDI, and the update it. Basically shift each line across to where the next line was. Basically a 200x100px rectangle is the canvas. Now a line is drawn from (x,y) 0,50 to 50,150 50,150 to 100,100 100,100 to 150,200 150,200 to 200,00 Then in the next step, the lines are cleared, and a new value is added, shifting the others (except for the first one). 0,50 to 50,80 50,80 to 100,100 100,100 to 150,200 150,200 to 200,200 And then the process starts over again... New value and shift. Please tell me if I've lost you. I suck at explaining. So I've come up with this, but the lines never show. Also I'm not sure if my method for clearing the graphic is correct. So here's the code. expandcollapse popup#include <GuiConstantsEx.au3> #include <GDIPlus.au3> #Include <Array.au3> Dim $var[4] Dim $text Dim $ret = 0 $var[0] = 52 $var[1] = 52 $var[2] = 52 $var[3] = 52 $hGUI = GUICreate("GDI+", 400, 300) $pic = GUICtrlCreatePic("", 0, 0, 400, 300) $hWnd = GUICtrlGetHandle($pic) GUISetState() ; Draw a string _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd) $tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20) $hPen = _GDIPlus_PenCreate (0x0000FF00, 10, 2) Do Sleep(150) $new = Random(0, 100, 1) _UpdateGraph($var, $new) Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _UpdateGraph(ByRef $var, $new_value) _GDIPlus_GraphicsClear ($hGraphic) $var[3] = $var[2] $var[2] = $var[1] $var[1] = $var[0] $var[0] = $new_value $text = "No." & @TAB & "X" & @TAB & "Y" & @TAB & "RET" & @CRLF $text &= 1 & @TAB & 0 & @TAB & 52 & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 0, 52, 48, $new_value, $hPen) $text &= 1 & @TAB & 48 & @TAB & $var[0] & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 48, $var[0], 96, $var[1], $hPen) $text &= 1 & @TAB & 96 & @TAB & $var[1] & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 96, $var[1], 144, $var[2], $hPen) $text &= 1 & @TAB & 144 & @TAB & $var[2] & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 144, $var[2], 192, $var[3], $hPen) $text &= 1 & @TAB & 192 & @TAB & $var[3] & @TAB & $ret & @CRLF ToolTip ($text, 0, 0) EndFunc ;==>_UpdateGraph Thanks, Brett ----- Its like a massive learning day for me! Woo! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
martin Posted September 28, 2008 Posted September 28, 2008 More unchartered teritory now. Now I just need to draw lines with GDI, and the update it. Basically shift each line across to where the next line was. Basically a 200x100px rectangle is the canvas. Now a line is drawn from (x,y) 0,50 to 50,150 50,150 to 100,100 100,100 to 150,200 150,200 to 200,00 Then in the next step, the lines are cleared, and a new value is added, shifting the others (except for the first one). 0,50 to 50,80 50,80 to 100,100 100,100 to 150,200 150,200 to 200,200 And then the process starts over again... New value and shift. Please tell me if I've lost you. I suck at explaining. So I've come up with this, but the lines never show. Also I'm not sure if my method for clearing the graphic is correct. So here's the code. expandcollapse popup#include <GuiConstantsEx.au3> #include <GDIPlus.au3> #Include <Array.au3> Dim $var[4] Dim $text Dim $ret = 0 $var[0] = 52 $var[1] = 52 $var[2] = 52 $var[3] = 52 $hGUI = GUICreate("GDI+", 400, 300) $pic = GUICtrlCreatePic("", 0, 0, 400, 300) $hWnd = GUICtrlGetHandle($pic) GUISetState() ; Draw a string _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd) $tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20) $hPen = _GDIPlus_PenCreate (0x0000FF00, 10, 2) Do Sleep(150) $new = Random(0, 100, 1) _UpdateGraph($var, $new) Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _UpdateGraph(ByRef $var, $new_value) _GDIPlus_GraphicsClear ($hGraphic) $var[3] = $var[2] $var[2] = $var[1] $var[1] = $var[0] $var[0] = $new_value $text = "No." & @TAB & "X" & @TAB & "Y" & @TAB & "RET" & @CRLF $text &= 1 & @TAB & 0 & @TAB & 52 & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 0, 52, 48, $new_value, $hPen) $text &= 1 & @TAB & 48 & @TAB & $var[0] & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 48, $var[0], 96, $var[1], $hPen) $text &= 1 & @TAB & 96 & @TAB & $var[1] & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 96, $var[1], 144, $var[2], $hPen) $text &= 1 & @TAB & 144 & @TAB & $var[2] & @TAB & $ret & @CRLF $ret = _GDIPlus_GraphicsDrawLine ($hGraphic, 144, $var[2], 192, $var[3], $hPen) $text &= 1 & @TAB & 192 & @TAB & $var[3] & @TAB & $ret & @CRLF ToolTip ($text, 0, 0) EndFunc ;==>_UpdateGraph Thanks, Brett ----- Its like a massive learning day for me! Woo!$hPen = _GDIPlus_PenCreate (0xFF00FF00, 10, 2);don't make the pen invisible then you can see the lines. 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.
BrettF Posted September 28, 2008 Author Posted September 28, 2008 Bahahahahah woops! Thankyou! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
ProgAndy Posted September 28, 2008 Posted September 28, 2008 Also, you should use timerInit instead of sleep, so you the GUIClose is recognized Also, free the resources on Exit. $hPen = _GDIPlus_PenCreate (0xFF00FF00, 10, 2) $Timer = TimerInit() Do If TimerDiff($Timer) > 150 Then $new = Random(0, 100, 1) _UpdateGraph($var, $new) $Timer = TimerInit() EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Community On Patrol Posted September 28, 2008 Posted September 28, 2008 Hi BrettF, Please create descriptive topics. Using one word topics makes it really difficult to use the search feature, and those that could probably answer your question will probably not even read your thread. Doing it enough could cause your posting privileges to be taken away all together, and we don't want that . Thanks.
BrettF Posted September 28, 2008 Author Posted September 28, 2008 Oh forgot to free. The Sleep isn't an issue, because in the full script, Timer is used... Thanks, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
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