Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
%IDC_Graphic = 500 : %ID_Timer = 501
Global hDlg, hDesktopDC As Dword, pt As PointAPI
Global x,y,w,h,m,n,x1,y1 As Long
Function PBMain() As Long
w = 10 : h = 10 : m = 10 : n = 10
Dialog New Pixels, 0, "gbMagnify",0,0,w*(2*m+1),h*(2*n+1), %WS_Popup To hDlg
Control Add Graphic, hDlg, %IDC_Graphic, "",0,0,(2*m+1)*w,(2*n+1)*h
Graphic Attach hDlg, %IDC_Graphic
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc()
Select Case Cb.Msg
Case %WM_InitDialog : SetTimer(hDlg, %ID_Timer, 50&, %NULL)
Case %WM_Timer : GetCursorPos pt : DrawPixels
Case %WM_ContextMenu : Dialog End hDlg
End Select
End Function
Sub DrawPixels
hDeskTopDC = GetDC(%Null)
For x = -m To m : x1 = (x+m)*w
For y = -n To n : y1 = (y+n)*h
Graphic Box (x1,y1)-(x1+w-1,y1+h-1),0,-1,GetPixel(hDeskTopDC,pt.x+x,pt.y+y)
Next y : Next x
ReleaseDC(%Null,hDeskTopDC)
End Sub
'gbs_01102
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm