CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Location
    Chennai, Tamilnadu, India
    Posts
    18

    Images to be resized in run time

    Hai Friends

    Howz the day? In my project the image has to be expanded or shrink of the user desire.

    For example i loaded two image control or picturebox control in the frame.I would like to shrink or expand the image or picturebox of the user desire in the run time.(Also it has expanded in horizontal,vertical as well as in cornerwise)

    (Just as we do in the MS-Word for creating the textboxes as well in vb design time.)

    Is any have the idea to do this.please pour in your idea or snippets or peice of code.

    Thanks in advance.

    Cheers
    SATHISH KUMAR G
    Winners Never Quit
    Quitters Never Win

  2. #2
    Join Date
    Jul 2003
    Location
    Chennai
    Posts
    42
    Hi Sathish,

    Here is a sample code, do enhance it.

    I have one Image Control on the Form.

    Create a Project and a form with Image Control. Paste the code and run the application.


    ***********************************************

    Dim lvMousePressed As Boolean

    Private Sub Form_Load()

    Image1.Stretch = True
    End Sub

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.MousePointer = vbDefault

    End Sub

    Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

    If Me.MousePointer = vbSizeWE Then
    lvMousePressed = True
    End If
    End Sub

    Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    If lvMousePressed = True Then
    Image1.Width = X
    Exit Sub
    End If


    If X > Image1.Width - 150 Then
    Me.MousePointer = vbSizeWE
    Else
    Me.MousePointer = vbDefault
    End If
    End Sub

    Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

    lvMousePressed = Not lvMousePressed
    End Sub

    ***********************************************


    All the Best !!!!

    Bye
    Soundar
    your's
    Soundar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured