how can i zoom an image inside a picturebox? and i also want to know how can i make a picture inside the picturebox draggable while at the same time, it can be zoomed in and out.
my goal is to crop an image inside the picturebox and i can zoom and drag the image inside if necessary, thanks :)
Uncommented but free code to draw a zoomed image in a picture box with a trackbar. :)
Public Class Form1 Private TheImageOpened As Bitmap Private TheImageRectThatCanBeManipulated As Rectangle Private TrackBarCenter As Integer = 8 Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. TrackBar1.Minimum = 1 TrackBar1.Maximum = 16 TrackBar1.Value = TrackBarCenter End Sub Private Sub ButtonOpenTheImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOpenTheImage.Click Dim OpenFileDialog As New OpenFileDialog OpenFileDialog.Filter = "Image Files|*.png;*.jpg;*.bmp" OpenFileDialog.FilterIndex = 0 OpenFileDialog.RestoreDirectory = True 'Fix Bad logic in Xp that will cause 'Environment.CurrentDirectory 'My.Application.Info.DirectoryPath 'to retrieve the directory of the path opened from this dialog instead of 'the app directory. If OpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then TheImageOpened = New Bitmap(OpenFileDialog.FileName) TheImageRectThatCanBeManipulated = New Rectangle(Point.Empty, TheImageOpened.Size) PictureBox1.Invalidate() End If OpenFileDialog.Reset() OpenFileDialog.Dispose() End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint If TheImageOpened IsNot Nothing Then e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic e.Graphics.DrawImage(TheImageOpened, TheImageRectThatCanBeManipulated) End If End Sub Private Sub TrackBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.ValueChanged If TheImageOpened IsNot Nothing Then TheImageRectThatCanBeManipulated.Width = TheImageOpened.Width * (TrackBar1.Value / TrackBarCenter) TheImageRectThatCanBeManipulated.Height = TheImageOpened.Height * (TrackBar1.Value / TrackBarCenter) PictureBox1.Invalidate() End If End Sub End Class
Edited 5 Years Ago by Unhnd_Exception: n/a
OMG Unhnd_Exception, that was great! thanks! theres one more thing, how can i make the image inside the picturebox draggable while it can be zoomed in and out? because i want a certain part of the image cropped and zoomed, thanks for your answer! youre an angel! :)
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...
there are five tables (personTb, addressTb,churchTb) each holds data pertinent to an individual; (personAddress,personChurch) each hold the primary key for the person table and corresponding table IE personAddress holds primary key for addressTb.
both snippets work, my question is; Is my join correctly formatted?
select concat(personTb.p_fName,' ',personTb.p_mName,'. ',personTb.p_lName) ...