Hi @Les ,
how to we find all posts that I have made here like the old site did?
You can see them in 'Activity'.
For picture zoom, also check : https://www.codeproject.com/Articles/21097/PictureBox-Zoom
In Visual Basic, the code looks like:
Private _ZoomFactor As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TrackBar1.Minimum = 1
TrackBar1.Maximum = 3
TrackBar1.Value = 2
_ZoomFactor = TrackBar1.Value
PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
PictureBox1.Image = Image.FromFile("your picture path")
End Sub
Private Sub TrackBar1_ValueChanged(sender As Object, e As EventArgs) Handles TrackBar1.ValueChanged
_ZoomFactor = TrackBar1.Value
Label1.Text = String.Format("x{0}", _ZoomFactor)
End Sub
Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
If PictureBox1.Image Is Nothing Then Return
UpdateZoomedImage(e)
End Sub
Private Sub UpdateZoomedImage(ByVal e As MouseEventArgs)
Dim zoomWidth As Integer = PictureBox2.Width / _ZoomFactor
Dim zoomHeight As Integer = PictureBox2.Height / _ZoomFactor
Dim halfWidth As Integer = zoomWidth / 2
Dim halfHeight As Integer = zoomHeight / 2
Dim tempBitmap As Bitmap = New Bitmap(zoomWidth, zoomHeight, PixelFormat.Format24bppRgb)
Dim bmGraphics As Graphics = Graphics.FromImage(tempBitmap)
bmGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic
bmGraphics.DrawImage(PictureBox1.Image, New Rectangle(0, 0, zoomWidth, zoomHeight), New Rectangle(e.X - halfWidth, e.Y - halfHeight, zoomWidth, zoomHeight), GraphicsUnit.Pixel)
PictureBox2.Image = tempBitmap
bmGraphics.DrawLine(Pens.Black, halfWidth + 1, halfHeight - 4, halfWidth + 1, halfHeight - 1)
bmGraphics.DrawLine(Pens.Black, halfWidth + 1, halfHeight + 6, halfWidth + 1, halfHeight + 3)
bmGraphics.DrawLine(Pens.Black, halfWidth - 4, halfHeight + 1, halfWidth - 1, halfHeight + 1)
bmGraphics.DrawLine(Pens.Black, halfWidth + 6, halfHeight + 1, halfWidth + 3, halfHeight + 1)
bmGraphics.Dispose()
PictureBox2.Refresh()
End Sub
Result of my test.
Hope it could be helpful.
Best Regards,
Xingyu Zhao
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
. Hopefully I am making myself clear.