Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE "gbMagnify.exe"
#Dim All
%Unicode=1
#Include "Win32API.inc"
%IDC_Graphic = 500
Global hDlg, hDesktopDC As Dword, pt As PointAPI
Global x,y,w,h,m,n,x1,y1,x2,y2 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_LButtonDown : SetCapture hDlg : hDeskTopDC = GetDC(%Null)
Case %WM_MouseMove : If GetCapture = hDlg Then GetCursorPos pt : DrawPixels
Case %WM_LButtonUp : ReleaseCapture : ReleaseDC(%Null, hDeskTopDC)
Case %WM_ContextMenu : Dialog End hDlg
End Select
End Function
Sub DrawPixels
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
End Sub
'gbs_01100
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm