picture box in vb.net 2003.

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2007
Posts: 23
Reputation: guptaalok12 is an unknown quantity at this point 
Solved Threads: 0
guptaalok12 guptaalok12 is offline Offline
Newbie Poster

picture box in vb.net 2003.

 
0
  #1
Jun 14th, 2007
hi i am using vb.net 2003 ,i have got a problem ,i have a 'tif' image .i am showing it in picture box ,now i want to cut some portion of this image and save in another location .so how can i do it.Pls help
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,348
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1461
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: picture box in vb.net 2003.

 
0
  #2
Jun 14th, 2007
moved
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 812
Reputation: arjunsasidharan is on a distinguished road 
Solved Threads: 13
arjunsasidharan's Avatar
arjunsasidharan arjunsasidharan is offline Offline
Practically a Posting Shark

Re: picture box in vb.net 2003.

 
0
  #3
Jun 14th, 2007
What you want to do is crop a particular image and save it in different location?
There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: picture box in vb.net 2003.

 
0
  #4
Jun 15th, 2007
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: picture box in vb.net 2003.

 
1
  #5
Jun 16th, 2007
Try this and see if it is what you want.
    Private Sub btnCropImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCropImage.Click
        If PictureBox1.Image Is Nothing Then Exit Sub
        '-----------------------------------------------------------
        ' The size is how wide and tall the cropped protion is
        ' The Point is x,y of where your cropped portion starts
        ' Call the CropImage as below
        '------------------------------------------------------------        PictureBox2.Image = CropImage(PictureBox1.Image, New Size(100, 100), New Point(100, 100)).Clone
    End Sub


    Private Function CropImage(ByVal SrcBmp As Bitmap, ByVal NewSize As Size, ByVal StartPoint As Point) As Bitmap
        ' Set up the rectangle that shows the portion of image to be cropped
        Dim SrcRect As New Rectangle(StartPoint.X, StartPoint.Y, NewSize.Width, NewSize.Height)
        ' Now set up the destination rectangle(DestRect) and bitmap(DestBmp)
        Dim DestRect As New Rectangle(0, 0, NewSize.Width, NewSize.Height)
        Dim DestBmp As New Bitmap(NewSize.Width, NewSize.Height, Imaging.PixelFormat.Format32bppArgb)
        ' Set the graphics to the destination bitmap(DestBmp)
        Dim g As Graphics = Graphics.FromImage(DestBmp)
        ' and draw the image from source bitmap (SrcRect) to the 
        ' destination bitmap(DestBmp) using the destination and
        ' source rectangles.
        g.DrawImage(SrcBmp, DestRect, SrcRect, GraphicsUnit.Pixel)
        ' finally return the destBmp
        Return DestBmp
    End Function
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC