CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: How to ......

  1. #1
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    How to ......

    How to make invert this code:
    x = Picture1.Height
    x = 0
    Do Until x >= 4700
    x = x + 1
    me.Refresh
    Picture1.Height = x
    Loop


    so that it will scroll from bottom to top not from top to bottom

    Thank You



  2. #2
    Join Date
    Oct 1999
    Posts
    25

    Re: How to ......

    If you are doing something like that, it is probably better to use a timer than a do loop, but the idea is the same. I think the visual effect you will get is that it cuts off from the bottom up. You would initiate the value of X like you have written at x = Picture1.Height, then in your do loop decrement x by one, x=x-1. and set the condition to loop until x = 0.

    Sky1000




  3. #3
    Join Date
    Aug 1999
    Posts
    10

    Re: How to ......

    Simple.
    Just use the TOP and LEFT member variables to set the upper left position of
    your control coninuosly, i.e.


    dim lngX as long
    dim lngY as long
    dim lngXSize as long

    lngXSize = 0
    while lngXSize <= 4700
    lngXSize = lngXSize + 1
    lngX = 0
    lngY = 0
    picture1.top = lngY
    picture1.left = lngX
    picture1.height = lngXSize
    me.repaint
    wend







  4. #4
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: How to ......

    hmm, PedroD? your code does the same function as mine, but I need to reverse it and your code seem to do the same thing --- from top to bottom but I need to go from BOTTOM to TOP and so that upper part was moving and lower part (base) would remain still...that's what kind of progress bar I need


  5. #5
    Join Date
    Aug 1999
    Posts
    10

    Re: How to ......

    Sorry about that.. Didn't see that your code was placing the picture object.
    Here's what you need to do in order to get a "bottoms up" version of the mentioned code snippet:


    Dim lngPictureHeight as Long ' The final height of the picture
    Dim lngBaseLineY as Long ' The base line for the picture (vertical)
    Dim lngYpos as Long ' ditto

    lngBaseLineY = 4700 ' Base distance from Top
    lngPictureHeight = 3000 ' Insert correct value here
    lngYpos = lngBaseLineY ' Vertical start position


    While (lngBaseLineY - lngYpos) < lngPictureHeight
    lngYpos = lngYpos - 1
    picture1.top = lngYpos ' Move picture up
    picture1.height = picture1.height + 1 ' Scale the vertical size
    ...(perhaps a delay here)...
    me.repaint
    Wend




    Hope this helps

    Pedro


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