Results 1 to 3 of 3

Thread: Help VB Won't listen to me!!!!!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Talking Help VB Won't listen to me!!!!!

    Ok, this makes NO sense to me here. This was working fine until I added code to my form load event to use BitBlt to paint the form background. I have a command button called cmdtoggle. Here is the code I have on it.
    VB Code:
    1. Private Sub cmdtoggle_Click()
    2. If cmdtoggle.Caption = "Show Playlist" Then
    3.     ListView1.Height = 4215
    4.     cmdtoggle.Caption = "Hide Playlist"
    5. Else
    6.     ListView1.Height = 6855
    7.     cmdtoggle.Caption = "Show Playlist"
    8. End If
    9.    
    10. End Sub

    The button caption says "Show Playlist" by default on startup. Somehow it gets confused and changes between the Show & hide button captions just fine, but it goes haywire on setting the height of listview1. When you click the button, it makes the listview height somthing that goes off the bottom of the screen. Any ideas? Thanks in advance.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    I removed this & it works fine......

    VB Code:
    1. Private Sub Form_Load()
    2. ScaleMode = 3
    3.     Picture1.AutoRedraw = True
    4.     Me.AutoRedraw = True
    5.    
    6.     For x = 0 To Width Step Picture1.Width
    7.         For y = 0 To Height Step Picture1.Height
    8.             DoEvents
    9.             BitBlt hDC, x, y, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hDC, 0, 0, vbSrcCopy
    10.         Next y
    11.     Next x
    12.  
    13.  
    14. End Sub
    Why does the BitBlt code that paints the form mess up the code on a command button??

  3. #3
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Your problem is actually this one line:

    VB Code:
    1. ScaleMode = 3

    Which is setting the ScaleMode to pixels. Hence, 4000px high will go off the bottom of the screen. A standard screen res may be as little as 800x600 pixels. 4000 is obviously way beyond that...

    Either set the ScaleMode to 1 (twips) or adjust your sizing values to match pixels.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

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