Markus Posted March 29, 2007 Share Posted March 29, 2007 How to draw live and without window reactivation? #include <GUIConstants.au3> #include <misc.au3> Global $vorher_x_pos=0,$vorher_y_pos=0 Global $storaged_x_pos[10000],$storaged_y_pos[10000] Global $count=0 Opt("MouseCoordMode", 0) $child=GUICreate("My Draw",600,600) $a=GuiCtrlCreateGraphic(0, 0, 600,600) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetColor(-1,0) GUISetState() Do $msg=GUIGetMsg() If _IsPressed(01) Then While _IsPressed(01) $pos=MouseGetPos() If $pos[0]-4<>$vorher_x_pos Or $pos[1]-30<>$vorher_y_pos Then $storaged_x_pos[$count]=$pos[0]-4 $storaged_y_pos[$count]=$pos[1]-30 $vorher_x_pos=$storaged_x_pos[$count] $vorher_y_pos=$storaged_y_pos[$count] $count+=1 EndIf WEnd For $i=1 To $count GUICtrlSetGraphic ($a, $GUI_GR_PIXEL ,$storaged_x_pos[$i], $storaged_y_pos[$i]) Next GUISetState(@SW_HIDE) GUISetState() $count=1 EndIf Until $msg=$GUI_EVENT_CLOSE "It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output Link to comment Share on other sites More sharing options...
AutoItKing Posted March 29, 2007 Share Posted March 29, 2007 This is not a general support forum! http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script] Link to comment Share on other sites More sharing options...
Markus Posted March 29, 2007 Author Share Posted March 29, 2007 But it's an example script OK, i have to admit that my question is verbalized that way, that i should have posted it in the support forum... "It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted March 29, 2007 Share Posted March 29, 2007 GUICtrlSetGraphic($a, $GUI_GR_REFRESH) #include <GUIConstants.au3> #include <misc.au3> Global $vorher_x_pos=0,$vorher_y_pos=0 Global $storaged_x_pos[10000],$storaged_y_pos[10000] Global $count=0 Opt("MouseCoordMode", 0) $child=GUICreate("My Draw",600,600) $a=GuiCtrlCreateGraphic(0, 0, 600,600) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetColor(-1,0) GUISetState() Do $msg=GUIGetMsg() If _IsPressed(01) Then While _IsPressed(01) $pos=MouseGetPos() If $pos[0]-4<>$vorher_x_pos Or $pos[1]-30<>$vorher_y_pos Then $storaged_x_pos[$count]=$pos[0]-4 $storaged_y_pos[$count]=$pos[1]-30 $vorher_x_pos=$storaged_x_pos[$count] $vorher_y_pos=$storaged_y_pos[$count] $count+=1 EndIf WEnd For $i=1 To $count GUICtrlSetGraphic ($a, $GUI_GR_PIXEL ,$storaged_x_pos[$i], $storaged_y_pos[$i]) Next GUICtrlSetGraphic($a, $GUI_GR_REFRESH) $count=1 EndIf Until $msg=$GUI_EVENT_CLOSE Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 29, 2007 Share Posted March 29, 2007 Wow! it's realy cool! I didn't know that it is possible to drowing with AutoIt! Here how you can drown "on-fly" (see what you drowing): #include <GUIConstants.au3> Opt("MouseCoordMode", 0) Global $vorher_x_pos=0,$vorher_y_pos=0 $child=GUICreate("My Draw",600,600) $a=GuiCtrlCreateGraphic(0, 0, 600,600) GUISetState() Do $msg=GUIGetMsg() $CurInfo = GUIGetCursorInfo() If IsArray($CurInfo) And $CurInfo[2] = 1 Then AdlibEnable("Refresh", 10) While $CurInfo[2] = 1 $CurInfo = GUIGetCursorInfo() If $CurInfo[0]-4 <> $vorher_x_pos Or $CurInfo[1]-30 <> $vorher_y_pos Then $vorher_x_pos = $CurInfo[0]-4 $vorher_y_pos = $CurInfo[1]-30 GUICtrlSetGraphic($a, $GUI_GR_PIXEL, $vorher_x_pos, $vorher_y_pos) EndIf WEnd AdlibDisable() EndIf Until $msg=$GUI_EVENT_CLOSE Func Refresh() GUICtrlSetGraphic($a, $GUI_GR_REFRESH) EndFunc If you set the backcolour of graphic to white, then you see a litle "flicking" of window when its refreshing.  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Automan Empire Posted March 29, 2007 Share Posted March 29, 2007 Here is a quick modification to thicken the "ink"... #include <GUIConstants.au3> Opt("MouseCoordMode", 0) Global $vorher_x_pos=0,$vorher_y_pos=0 $child=GUICreate("My Draw",600,600) $a=GuiCtrlCreateGraphic(0, 0, 600,600) GUISetState() Do $msg=GUIGetMsg() $CurInfo = GUIGetCursorInfo() If IsArray($CurInfo) And $CurInfo[2] = 1 Then AdlibEnable("Refresh", 10) While $CurInfo[2] = 1 $CurInfo = GUIGetCursorInfo() If $CurInfo[0]-4 <> $vorher_x_pos Or $CurInfo[1]-30 <> $vorher_y_pos Then $vorher_x_pos = $CurInfo[0]-4 $vorher_y_pos = $CurInfo[1]-30 GUICtrlSetGraphic($a, $GUI_GR_PIXEL, $vorher_x_pos, $vorher_y_pos) GUICtrlSetGraphic($a, $GUI_GR_PIXEL, $vorher_x_pos+1, $vorher_y_pos+1) GUICtrlSetGraphic($a, $GUI_GR_PIXEL, $vorher_x_pos-1, $vorher_y_pos-1) GUICtrlSetGraphic($a, $GUI_GR_PIXEL, $vorher_x_pos+1, $vorher_y_pos-1) GUICtrlSetGraphic($a, $GUI_GR_PIXEL, $vorher_x_pos-1, $vorher_y_pos+1) EndIf WEnd AdlibDisable() EndIf Until $msg=$GUI_EVENT_CLOSE Func Refresh() GUICtrlSetGraphic($a, $GUI_GR_REFRESH) EndFunc "I've seen your work in the past, and it's novice at best..." SmOke_N Link to comment Share on other sites More sharing options...
Automan Empire Posted March 29, 2007 Share Posted March 29, 2007 Found the $GUI_GR_DOT syntax ... #include <GUIConstants.au3> Opt("MouseCoordMode", 0) Global $vorher_x_pos=0,$vorher_y_pos=0 $child=GUICreate("My Draw",600,600) $a=GuiCtrlCreateGraphic(0, 0, 600,600) GUISetState() Do $msg=GUIGetMsg() $CurInfo = GUIGetCursorInfo() If IsArray($CurInfo) And $CurInfo[2] = 1 Then AdlibEnable("Refresh", 10) While $CurInfo[2] = 1 $CurInfo = GUIGetCursorInfo() If $CurInfo[0]-4 <> $vorher_x_pos Or $CurInfo[1]-30 <> $vorher_y_pos Then $vorher_x_pos = $CurInfo[0]-4 $vorher_y_pos = $CurInfo[1]-30 GUICtrlSetGraphic($a, $GUI_GR_Dot, $vorher_x_pos, $vorher_y_pos) EndIf WEnd AdlibDisable() EndIf Until $msg=$GUI_EVENT_CLOSE Func Refresh() GUICtrlSetGraphic($a, $GUI_GR_REFRESH) EndFunc "I've seen your work in the past, and it's novice at best..." SmOke_N Link to comment Share on other sites More sharing options...
Automan Empire Posted March 29, 2007 Share Posted March 29, 2007 And to get even more obsessive-compulsive, this fills in the center of the Dot... #include <GUIConstants.au3> Opt("MouseCoordMode", 0) Global $vorher_x_pos=0,$vorher_y_pos=0 $child=GUICreate("My Draw",600,600) $a=GuiCtrlCreateGraphic(0, 0, 600,600) GUISetState() Do $msg=GUIGetMsg() $CurInfo = GUIGetCursorInfo() If IsArray($CurInfo) And $CurInfo[2] = 1 Then AdlibEnable("Refresh", 10) While $CurInfo[2] = 1 $CurInfo = GUIGetCursorInfo() If $CurInfo[0]-4 <> $vorher_x_pos Or $CurInfo[1]-30 <> $vorher_y_pos Then $vorher_x_pos = $CurInfo[0]-4 $vorher_y_pos = $CurInfo[1]-30 GUICtrlSetGraphic($a, $GUI_GR_Dot, $vorher_x_pos, $vorher_y_pos) GUICtrlSetGraphic($a, $GUI_GR_PIXEL, $vorher_x_pos, $vorher_y_pos) EndIf WEnd AdlibDisable() EndIf Until $msg=$GUI_EVENT_CLOSE Func Refresh() GUICtrlSetGraphic($a, $GUI_GR_REFRESH) EndFunc "I've seen your work in the past, and it's novice at best..." SmOke_N Link to comment Share on other sites More sharing options...
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