|
-
Feb 24th, 2004, 03:41 AM
#1
Thread Starter
New Member
Dissappearing Image
When i run this code, and the mouse moves over the picture box for some reason the image displayed just dissappears.
Private Sub picBoard_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picImage.MouseMove
If isDragging Then
Dim gr As Graphics = picImage.CreateGraphics
gr.Clear(picImage.BackColor)
dim X1 as Integer
Dim Y1 as Integer
Dim rect As New Rectangle(startX, startY, e.X - startX, e.Y - startY)
X1 = e.X – startX
Y1 = e.Y - startY
gr.DrawRectangle(Pens.Red, rect)
gr.FillRectangle(Brushes.Transparent, rect)
End If
Dim bmpCropped As New Bitmap(X1, Y1)
Dim grBitmap As Graphics = Graphics.FromImage(bmpCropped)
grBitmap.DrawImage(picImage.Image, 0, 0, rect, _
GraphicsUnit.Pixel)
picImage.Image = bmpCropped
picImage.SizeMode = PictureBoxSizeMode.Normal
gr.Dispose()
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|