|
-
Feb 23rd, 2004, 12:17 PM
#1
Thread Starter
New Member
Dissapearing image
This code works (i think)
basically what happens is that when the mouse is movd over the picture box the image disappears.
i can't figure out why though.
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 rect As New Rectangle(startX, startY, e.X - startX, e.Y - startY)
Dim X1 as integer = (e.X – startX)
Dim Y1 as integer = (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
|