Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleLet the user resize an image with the mouse
Keywordsresize, image, mouse
CategoriesControls, Graphics
 
Set an Image control's Stretch property to True. Use the control's MouseDown, MouseMove, and MouseUp event handlers to let the user drag the corner of the control.
 
Private m_Dragging As Boolean

Private Sub Form_Load()
    Image1.Stretch = True
End Sub

Private Sub Image1_MouseDown(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    m_Dragging = True
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    If Not m_Dragging Then Exit Sub

    Image1.Move 0, 0, X, Y
End Sub

Private Sub Image1_MouseUp(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    m_Dragging = False
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated