Does anyone know how the "dot-grid" is made that appears on the form or window of GUI construction programs?
Posted on 2005-10-16 01:45:17 by mikes
I guess it's a normal window with custom painting.
Posted on 2005-10-16 05:01:55 by Azrim
Try the following:


LOCAl rect:RECT
LOCAl ps:PAINTSTRUCT

;uses esi, ebx

.elseif eax==WM_PAINT
invoke BeginPaint,hWin,addr ps
invoke GetClientRect,hWin,addr rect
xor esi, esi
.WHILE esi < rect.right
xor ebx, ebx
.WHILE ebx < rect.bottom
invoke SetPixel,ps.hdc,esi, ebx,Black
add ebx, 15
.ENDW
add esi, 15
.ENDW
invoke EndPaint,hWin,addr ps
Posted on 2005-10-16 11:25:53 by JimmyClif
hehe that was one of the walls i hit when i tried to write a form with a grid
(i was i begginer), the grid itself wasnt so hard to paint but the problem was
it was ultra slow!, much later i learned that i need to use a "backbuffer"
for such tasks...

search for a <Back Buffer Shell> examples, and see how KetilO does it in his ResEd

Posted on 2005-10-16 11:38:04 by drizz
@jimmyclif

this function returns always FFFFFFFFh
invoke SetPixel,ps.hdc,esi, ebx,Black
Posted on 2005-10-17 07:25:34 by diablo2oo2
Works fine for me.

WinXp SP2
Attachments:
Posted on 2005-10-17 07:43:34 by JimmyClif
just strange. when i run your code in debugger i always see FFFFFFFFh as return value. but i can see the dots...

the main point is that it works  :D
Posted on 2005-10-17 07:51:18 by diablo2oo2
If the function fails, the return value is 1.

So I wouldn't worry about FFFFFFFFh
Posted on 2005-10-17 22:13:18 by ti_mo_n

If the function fails, the return value is 1.

So I wouldn't worry about FFFFFFFFh


lol, my old win32help file told me that:
If the function fails, the return value is -1


but i believe i should trust the new platformsdk:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_3030.asp
Posted on 2005-10-18 10:01:54 by diablo2oo2
I'm having trouble making the example code work. In this code below, I am jast trying to paint one red dot at 200,200.

The problem seems to be in exiting from the WM_PAINT event. Even if I strip out the code in the 3rd section to just an ret,
the program fails to draw the windows and controls that it normally does.

As can be seen in the 2nd section, I am returning a 0.


cmp ,WM_PAINT
je !wmPaint

...

!wmPaint:
mov esi,!OBMain
mov eax,
cmp eax,0
je !DefWndProc
call dword eax
xor eax,eax
jmp !Finish

...

OBMain_paint:
; LN:21904 beginpaint FormWindow
mov edi,!FormWindow
mov [!TargetGUIDesc],edi
invoke BeginPaint, dword ,PaintStruct
; LN:21905 setpixel 200,200,255
mov eax,200
mov [_ArgSafe0],eax
mov eax,200
mov [_ArgSafe1],eax
mov eax,255
invoke SetPixel, dword ,[_ArgSafe0],[_ArgSafe1],eax
; LN:21906 endpaint FormWindow
mov edi,!FormWindow
invoke EndPaint, dword ,PaintStruct
; LN:21907 END EVENT
ret

...

!Finish:
pop edi esi ebx
return


Posted on 2005-10-25 20:20:18 by mikes