MvGulik Posted January 13, 2013 Posted January 13, 2013 So far (~6 years according to some old message I posted about it.) all graphical scripts that seem to use some form of setting a single pixel seems to fail to actually set the pixel. Tested on multiple computers. Think 5 by now, 4 on Win-XP(think both NL and Eng) and 1 Win-Vista(NL). (all 32bits) Bummer. O well. 1) GUICtrlSetGraphic, $GUI_GR_RECT, size(1,1) exception (Aug 2006) 2) Recursion level limit (Jan 2013) "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
UEZ Posted January 13, 2013 Posted January 13, 2013 (edited) What about this? expandcollapse popup#include <StaticConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> _GDIPlus_Startup() Global Const $STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0 Global Const $hGUI = GUICreate("Test", 300, 200) Global Const $iPic = GUICtrlCreatePic("", 10, 10, 200, 180, $SS_SUNKEN) Global Const $iBtn = GUICtrlCreateButton("Exit", 250, 150, 40, 30) GUISetState() Global $hBitmap = _GDIPlus_InitImage(200, 180) Global $x, $y, $iStep = 8 For $y = 1 To 180 Step $iStep For $x = 1 To 200 Step $iStep _GDIPlus_DrawPixel($hBitmap, $x, $y, 0xFFFF0000) Next Next CopyBitmap2PicCtrl($hBitmap, $iPic) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iBtn _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() GUIDelete() Exit EndSwitch Until False Func CopyBitmap2PicCtrl($hBitmap, $iCtrlId) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) If @error Then Return SetError(1, 0, 0) Local $hB = GUICtrlSendMsg($iCtrlId, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap) If $hB Then _WinAPI_DeleteObject($hB) _WinAPI_DeleteObject($hHBitmap) Return 1 EndFunc Func _GDIPlus_InitImage($iW, $iH, $bCreateHBitmap = False, $iColorBg = 0xFFF0F0F0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($aResult[6]) _GDIPlus_GraphicsClear($hCtxt, $iColorBg) _GDIPlus_GraphicsDispose($hCtxt) If $bCreateHBitmap Then Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($aResult[6]) Return $hHBitmap EndIf Return $aResult[6] EndFunc Func _GDIPlus_DrawPixel(ByRef $hBitmap, $iX, $iY, $iColor, $iSize = 1) Local $hBrush = _GDIPlus_BrushCreateSolid($iColor) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillRect($hCtxt, $iX, $iY, $iSize, $iSize, $hBrush) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hBrush) EndFunc Br, UEZ Edited January 13, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
MvGulik Posted January 13, 2013 Author Posted January 13, 2013 What about this?That one is working ok on this end. (Seeing one pixel red dots.) "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
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