please Can Any one help me!
i am using
queens_imageControl Author:Anthony Queen,
Article:Pan and Zoom Very Large Images
which has a feature pan zoom and window zoom.
I need to implement crop feature in it but i am not able to do it.
what i did is :-On DrawingBorad control
i created a cropImage()function which take two params
ie.cropImage(img,cropArea)and function returns cropped portion of image(ie.bmpCrop) which i take it in variable of type image ie.m_cropedImage on mouseUpevent of drawingboard control.
image is a:- image of type system.drawing.Image
cropArea is a:-area drawn from a rectangle.
QueensImageControl :-it is image viewer
on mouseUp_event i am calling crop function ie.cropImage(m_OriginalImage, m_Select_Rect)and holding cropped image in variable(ie.m_cropedImage) returned by cropImage()function
then i created a method crop()in QueensImage control in which i am displaying the value of variable(ie.m_cropedImage)to drawingBoard
and in my main form of my application i am calling the crop method
but on run time it doesnot display the croppedimage in the image control
i dont know what is going wrong
My code is:-
OnDrawingboard Control
Public Function cropImage(ByVal img As Image, ByVal cropArea As Rectangle) As Image
Dim bmpImage As New Bitmap(img)
Dim bmpCrop As Bitmap = bmpImage.Clone(cropArea, bmpImage.PixelFormat)
Return DirectCast(bmpCrop, Image)
End Function
OnMouseUp_event of Drawingboard Control
Public Sub DrawingBoard_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
If m_OriginalImage Is Nothing Then Exit Sub
If Not PanMode Then
EndPoint = New Point(e.X, e.Y)
If Selected_Rectangle = Nothing Then Exit Sub
m_cropedImage = cropImage(m_OriginalImage, m_Select_Rect)
'ZoomSelection()
End If
End Sub
On Queens_ImageControl
Public Sub crop()
Dim crp As DrawingBoard = New DrawingBoard()
Me.DrawingBoard1.Image = crp.m_cropedImage
Me.Invalidate()
End Sub
On main form of my application
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Me.ImageControl1.crop()
End Sub
[edit]Tags changed from C# to VB - OriginalGriff[/edit]