MrCreatoR Posted March 2, 2007 Posted March 2, 2007 (edited) Hi to all, i get the idea for this function from this topic, and it seems that this work fine.expandcollapse popup;=============================================================================== ; Function Name: _GuiCreateGrid() ; Description: Create grid on the screen, using GUI windows. ; ; Parameter(s): $GridWidth = The Width of the grid, $GridHeight = The Height of the grid, ; $GridLineHeightWidth = This Parametr defines what Width/Height will be of all lines, ; $GridRange = Range between each line (Frequency/Interval), $GridColor = The color of grid, ; $TopMost = Defines if the grid will have Top Most attribute. ; ; Requirement(s): AutoIt 3.2.2.0. ; Return Value(s): If the total number of lines is more then 1024, ; or the parameter $GridRange less then 10, then @Error set to 1 and returned "" (empty string). ; Limit(s): 1) Maximum allowed lines in grid is 1024 (because Maximum number of GUI windows is 1024). ; 2) The grid is limited to 10 pixels range between each line (not less then 10 pixels range). ; ; Author(s): G.Sandler a.k.a CreatoR (MsCreatoR) ;=============================================================================== Func _GuiCreateGrid($GridWidth=@DesktopWidth, $GridHeight=@DesktopHeight, $GridLineHeightWidth=1, $GridRange=20, $GridColor=Default, $TopMost=0) If $GridLineHeightWidth < 1 Then $GridLineHeightWidth = 1 Local $LeftLinesNum = Round($GridWidth/$GridRange) Local $ToptLinesNum = Round($GridHeight/$GridRange) Local $i, $FirstLinePos, $TopMostStyle = 0, $MainTopPos = Default, $MainLeftPos = Default, $TopLinesAdd = 0, $LeftLinesAdd = 0 If $TopMost = 1 Then $TopMostStyle = 0x00000008 If $GridWidth = @DesktopWidth Then $MainLeftPos = 0 $LeftLinesAdd += 2 EndIf If $GridHeight = @DesktopHeight Then $MainTopPos = 0 $TopLinesAdd += 2 EndIf If ($LeftLinesNum + $LeftLinesAdd) + ($ToptLinesNum + $TopLinesAdd) >= 1024 Or $GridRange < 10 Then Return SetError(1, 0, "") $FirstLinePos = (@DesktopWidth/2) - ($GridWidth/2) For $i = 1 To $LeftLinesNum + $LeftLinesAdd $CurrentGui = GUICreate("Grid Width", $GridLineHeightWidth, $GridHeight, $FirstLinePos, $MainTopPos, 0x80880000, 0x00000080+$TopMostStyle) GUISetBkColor($GridColor, $CurrentGui) GUISetState(@SW_SHOW, $CurrentGui) $FirstLinePos += $GridRange Next $FirstLinePos = (@DesktopHeight/2) - ($GridHeight/2) - $GridRange For $i = 1 To $ToptLinesNum + $TopLinesAdd $CurrentGui = GUICreate("Grid Height", $GridWidth, $GridLineHeightWidth, $MainLeftPos, $FirstLinePos, 0x80880000, 0x00000080+$TopMostStyle) GUISetBkColor($GridColor, $CurrentGui) GUISetState(@SW_SHOW, $CurrentGui) $FirstLinePos += $GridRange Next EndFuncoÝ÷ Ù8^)¢µú+©àz±z["±·jëü±ëbµ«%zË-éõÒØb³¥·¯z¼¬½éߢ¹²}«-r©º×«Â¬¶WRÆ yìZ^ý¶®¶sd÷D¶W6WBgV÷C·¶W67ÒgV÷C²ÂgV÷CµVBgV÷C² ¥ôwV7&VFTw&BFW6·F÷vGFÂFW6·F÷VvBÂ"Â#RÂs2¤bW'&÷"FVà ×6t&÷bÂgV÷C´W'&÷"b333²gV÷C²ÂgV÷CµFW&Rv2âW'&÷"Fò7&VFRFRw&C²Ö×VÒÆÆ÷vVBÆæW2âw&B2#BâââgV÷C²fײ5"fײgV÷C´æBFRw&B2ÆÖFVBFòVÇ2&ævR&WGvVVâV6ÆæRæ÷BÆW72FVâVÇ2&ævRgV÷C²fײ5"fײ5"fײgV÷C´ô²ÒÒb3c#²UBgV÷C² W@¤VæD` ¥vÆR 6ÆVW¥tVæ@ ¤gVæ2VB W@¤VæDgVæ0 Edited March 2, 2007 by MsCreatoR 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
_Kurt Posted March 2, 2007 Posted March 2, 2007 (edited) Looks cool. but.. Greed? Don't you mean Grid Kurt EDIT: pressed the edit button? Edited March 2, 2007 by _Kurt Awaiting Diablo III..
MrCreatoR Posted March 2, 2007 Author Posted March 2, 2007 Don't you mean Gridoops... Thanks, i have changed the first post, but how do i change the name of the topic? 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
Moderators SmOke_N Posted March 2, 2007 Moderators Posted March 2, 2007 LOL... nice job... very unique. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
WeMartiansAreFriendly Posted March 2, 2007 Posted March 2, 2007 very creative. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Kickassjoe Posted April 30, 2007 Posted April 30, 2007 for some reason the grid's lines that are going up and down are a little bit too far down on the y axis... is there any way I can fix that? here is the source: #include <GuiConstants.au3> #include <Grids.au3> HotKeySet("{esc}", "Quit") $Main = GUICreate("Graph", 500, 500) _GuiCreateGrid(250, 250, 2, 10, 0xAA780C, 1) If @error Then MsgBox(16, "Error!", "There was an error to create the grid; maximum allowed lines in grid is 1024..." & @CR & "And the grid is limited to 10 pixels range between each line (not less then 10 pixels range)" & @CR & @CR & "OK --> EXIT") Exit EndIf GUISetState(@SW_SHOW, $Main) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $XLine[0] GUIDelete($XLine[0]) Case Else ;;; EndSelect WEnd Func Quit() Exit EndFunc and here is a pic of the problem: What goes around comes around... Payback's a bitch.
martin Posted December 2, 2007 Posted December 2, 2007 (edited) oops... Thanks, i have changed the first post, but how do i change the name of the topic?When you edit your original post you can change the title etc at the top. It took me a long time to realize that and I even asked Admin if they could change a title for me before I found it.I think it might be better to say$CurrentGui = GUICreate("Grid Height", $GridWidth, $GridLineHeightWidth, $MainLeftPos, $FirstLinePos,$WS_POPUP , 0x00000080+$TopMostStyle);0x80880000I.e. use $WS_POPUP rather than $WS_POPUPWINDOW because then you can have lines which are much narrower. Edited December 2, 2007 by martin 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.
Achilles Posted December 4, 2007 Posted December 4, 2007 Cool effect! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
MerkurAlex Posted December 4, 2007 Posted December 4, 2007 (edited) Very nice i decided to make transparency on the lines i also added splashtexton saying "Creating grid..." heres my code. expandcollapse popupFunc _GuiCreateGrid($GridWidth=@DesktopWidth, $GridHeight=@DesktopHeight, $GridLineHeightWidth=1, $GridRange=20, $GridColor=Default, $TopMost=0,$transparency=255) splashtexton("","Creating grid...",80,50,-1,-1,1+2) If $GridLineHeightWidth < 1 Then $GridLineHeightWidth = 1 Local $LeftLinesNum = Round($GridWidth/$GridRange) Local $ToptLinesNum = Round($GridHeight/$GridRange) Local $i, $FirstLinePos, $TopMostStyle = 0, $MainTopPos = Default, $MainLeftPos = Default, $TopLinesAdd = 0, $LeftLinesAdd = 0 If $TopMost = 1 Then $TopMostStyle = 0x00000008 If $GridWidth = @DesktopWidth Then $MainLeftPos = 0 $LeftLinesAdd += 2 EndIf If $GridHeight = @DesktopHeight Then $MainTopPos = 0 $TopLinesAdd += 2 EndIf If ($LeftLinesNum + $LeftLinesAdd) + ($ToptLinesNum + $TopLinesAdd) >= 1024 Or $GridRange < 10 Then Return SetError(1, 0, "") $FirstLinePos = (@DesktopWidth/2) - ($GridWidth/2) For $i = 1 To $LeftLinesNum + $LeftLinesAdd $CurrentGui = GUICreate("Grid Width", $GridLineHeightWidth, $GridHeight, $FirstLinePos, $MainTopPos, 0x80880000, 0x00000080+$TopMostStyle) GUISetBkColor($GridColor, $CurrentGui) GUISetState(@SW_SHOW, $CurrentGui) winsettrans($currentgui,"",$transparency) $FirstLinePos += $GridRange Next $FirstLinePos = (@DesktopHeight/2) - ($GridHeight/2) - $GridRange For $i = 1 To $ToptLinesNum + $TopLinesAdd $CurrentGui = GUICreate("Grid Height", $GridWidth, $GridLineHeightWidth, $MainLeftPos, $FirstLinePos, 0x80880000, 0x00000080+$TopMostStyle) GUISetBkColor($GridColor, $CurrentGui) GUISetState(@SW_SHOW, $CurrentGui) winsettrans($currentgui,"",$transparency) $FirstLinePos += $GridRange Next splashoff() EndFunc Edited December 4, 2007 by EagleClaw [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]
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