[IMG]http://g.image*********/0462/SCHREENEH.jpg[/Img]
[IMG]http://g.image*********/0240/ingameSCHREENEH.jpg[/img]
---------
Can anyone help me how to make 1 like that?
the sniperzoom tool
---------
Heres the original thread is very very old : http://www.mpgh.net/forum/164-combat...s-delight.html
thnx in advance
Help anyone?
Windows has a standard magnifier
Posts 1–6 of 6 · Page 1 of 1
Post a Reply
Tags for this Thread
None
Do not double post, here is something I whipped up quickly:
[highlight=vb.net]Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dynamically create a timer
Dim tmr As New Timer
tmr.Interval = 100
Dim eHandle As New EventHandler(AddressOf tmr_Tick)
AddHandler tmr.Tick, eHandle
tmr.Start()
End Sub
Private Sub tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim captureSize As Integer = 200
'Get a screenshot of the screen
Dim iScreen As Image = GetScreenShot(Screen.PrimaryScreen)
'Crop the image to the area around the mouse
Dim iCroped As Image = CropBitmap(iScreen, MousePosition.X - captureSize / 2, MousePosition.Y - captureSize / 2, captureSize, captureSize)
iScreen.Dispose()
'Enlarge the image to fit the picture box
Dim iEnlarged As Image = EnlargeImage(iCroped, PictureBox1.Width, PictureBox1.Height)
iCroped.Dispose()
PictureBox1.Image = iEnlarged
End Sub
'Functions copied from the internet
Private Function EnlargeImage(ByVal source As Image, ByVal width As Integer, ByVal height As Integer)
Dim bm_source As New Bitmap(source)
Dim bm_dest As New Bitmap(width, height)
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
gr_dest.DrawImage(bm_source, 0, 0, _
bm_dest.Width + 1, _
bm_dest.Height + 1)
gr_dest.Dispose()
bm_source.Dispose()
Return bm_dest
End Function
Private Function CropBitmap(ByRef bmp As Bitmap, ByVal cropX As Integer, ByVal cropY As Integer, ByVal cropWidth As Integer, ByVal cropHeight As Integer) As Bitmap
'I added some fixes to make sure there isn't out of memory errors
If cropX < 0 Then cropX = 0
If cropY < 0 Then cropY = 0
If cropX + cropWidth > bmp.Width Then cropX = bmp.Width - cropWidth
If cropY + cropHeight > bmp.Height Then cropY = bmp.Height - cropHeight
Dim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight)
Dim cropped As Bitmap = bmp.Clone(rect, bmp.PixelFormat)
Return cropped
End Function
Public Function GetScreenShot(ByVal Screen As Screen) As Image
Dim ReturnImage As New Bitmap(Screen.Bounds.Width, Screen.Bounds.Height, Imaging.PixelFormat.Format24bppRgb)
Using G As Graphics = Graphics.FromImage(ReturnImage)
G.CopyFromScreen(0, 0, 0, 0, Screen.Bounds.Size)
End Using
Return ReturnImage
End Function
End Class
[/highlight]
All you need is a picture box.
Originally Posted by master131
Do not double post, here is something I whipped up quickly:
[highlight=vb.net]Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dynamically create a timer
Dim tmr As New Timer
tmr.Interval = 100
Dim eHandle As New EventHandler(AddressOf tmr_Tick)
AddHandler tmr.Tick, eHandle
tmr.Start()
End Sub
Private Sub tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim captureSize As Integer = 200
'Get a screenshot of the screen
Dim iScreen As Image = GetScreenShot(Screen.PrimaryScreen)
'Crop the image to the area around the mouse
Dim iCroped As Image = CropBitmap(iScreen, MousePosition.X - captureSize / 2, MousePosition.Y - captureSize / 2, captureSize, captureSize)
iScreen.Dispose()
'Enlarge the image to fit the picture box
Dim iEnlarged As Image = EnlargeImage(iCroped, PictureBox1.Width, PictureBox1.Height)
iCroped.Dispose()
PictureBox1.Image = iEnlarged
End Sub
'Functions copied from the internet
Private Function EnlargeImage(ByVal source As Image, ByVal width As Integer, ByVal height As Integer)
Dim bm_source As New Bitmap(source)
Dim bm_dest As New Bitmap(width, height)
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
gr_dest.DrawImage(bm_source, 0, 0, _
bm_dest.Width + 1, _
bm_dest.Height + 1)
gr_dest.Dispose()
bm_source.Dispose()
Return bm_dest
End Function
Private Function CropBitmap(ByRef bmp As Bitmap, ByVal cropX As Integer, ByVal cropY As Integer, ByVal cropWidth As Integer, ByVal cropHeight As Integer) As Bitmap
'I added some fixes to make sure there isn't out of memory errors
If cropX < 0 Then cropX = 0
If cropY < 0 Then cropY = 0
If cropX + cropWidth > bmp.Width Then cropX = bmp.Width - cropWidth
If cropY + cropHeight > bmp.Height Then cropY = bmp.Height - cropHeight
Dim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight)
Dim cropped As Bitmap = bmp.Clone(rect, bmp.PixelFormat)
Return cropped
End Function
Public Function GetScreenShot(ByVal Screen As Screen) As Image
Dim ReturnImage As New Bitmap(Screen.Bounds.Width, Screen.Bounds.Height, Imaging.PixelFormat.Format24bppRgb)
Using G As Graphics = Graphics.FromImage(ReturnImage)
G.CopyFromScreen(0, 0, 0, 0, Screen.Bounds.Size)
End Using
Return ReturnImage
End Function
End Class
[/highlight]
All you need is a picture box.
Its worked thank you
i think its solved?
close?
Marked solved. No more posting unless you have an improved solution or a question directly relating to the thread.