E1M1 Posted September 6, 2011 Share Posted September 6, 2011 (edited) Just made label based paint to kill some time. so here it is.... Far from perfect but simple program that works. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 443, 192, 124, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $save = GUICtrlCreateButton("save", 0, 420, 75) $open = GUICtrlCreateButton("open", 80, 420, 75) ;~ MsgBox(0,0,$save) GUISetState(@SW_SHOW) Dim $array[(10 * 20) + 1][2] $c = 0 For $h = 1 To 10 For $w = 1 To 20 $array[$c][0] = GUICtrlCreateLabel("", $w * 20, $h * 20, 20, 20) $array[$c][1] = 0xffffff $c += 1 GUICtrlSetBkColor(-1, 0xffffff) Next Next #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() $stepuput = False If $nMsg > 4 And $nMsg < UBound($array) + 4 Then $nMsg -= 5 If $array[$nMsg][1] = 0 Then GUICtrlSetBkColor($array[$nMsg][0], 0xffffff) $array[$nMsg][1] = 0xffffff $stepuput = True Else GUICtrlSetBkColor($array[$nMsg][0], 0) $array[$nMsg][1] = 0 $stepuput = True EndIf EndIf If Not $stepuput Then Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $save $str = "" For $i = 0 To UBound($array) - 1 $tmp = $array[$i][1] If $tmp = 0 Then $tmp = "0" Else $tmp = "1" EndIf ;==> ConsoleWrite($tmp) $str &= $tmp Next FileDelete(@ScriptDir & "\image.txt") FileWrite(@ScriptDir & "\image.txt", $str) Case $open $a = StringSplit(FileRead(@ScriptDir & "\image.txt"), "") For $n = 1 To $a[0] $color = $a[$n] If $color = 0 Then $array[$n - 1][1] = 0 GUICtrlSetBkColor($array[$n - 1][0], 0) Else $array[$n - 1][1] = 0xffffff GUICtrlSetBkColor($array[$n - 1][0], 0xffffff) EndIf Next EndSwitch EndIf ;==> WEnd example image.txt 010101010101010101001010101010101010101101011111111111110110101101111000101111110111011110101011111010110111101010111111011101111010101111101011000010001000011101111111111111111110010101010101010101000 Edited September 6, 2011 by E1M1 edited 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