labels dissapear mysteriously with Form_Paint 
Author Message
 labels dissapear mysteriously with Form_Paint

I've got an app in which there are several labels. I've got a
Form_Paint where I've got an image being tiled over the form. The image
is selected randomly each time the form is double-clicked or resized.
The problem is when the form is double-clicked the labels seem to
disappear. They come back when the form is resized. I don't know what
is causing this. What;s even wierder is that when the mouse hovers over
the close, maximize/restore and minimize buttons, the labels reappear.
Would someone please look this over and let me know what I can do to
prevent the labels from disappearing? I was wondering if they are being
painted over? I don't have any code that does anything to the
visibility of the labels anywhere!  Thanks!

Jennifer

This is the code I am using in Form_Paint:

Private Sub Form_Paint()
    Dim a As Integer, b As Integer
    Dim ImgWidth As Integer
    Dim ImgHeight As Integer
    Dim FrmWidth As Integer
    Dim FrmHeight As Integer

    ImgWidth = picForm.Width
    ImgHeight = picForm.Height
    FrmWidth = Me.Width
    FrmHeight = Me.Height

    For a = 0 To FrmWidth Step ImgWidth
        For b = 0 To FrmHeight Step ImgHeight
            PaintPicture picForm, a, b
        Next b
    Next a
    'lblClues.Visible = True
End Sub

This is the code for double-clicking the form (the same code is used
with resizing the form):

Private Sub Form_DblClick()
    GetPic
    Call Form_Paint
End Sub

And this is the code I use to select a new image:

Public Sub GetPic()
    Dim MyValue As Integer
    Randomize
    MyValue = Int((73 * Rnd) + 1)
    picForm = LoadPicture(App.Path & BackNames(MyValue))
End Sub

The following is called in Form_Load to load the picture names into an
array:

Public Sub LoadBackGrPics()
    Dim a As Integer
    a = 1
    Open App.Path & "\Resources\BackNames.dat" For Input As #2
    Do While Not EOF(2)
        Input #2, BackNames(a)
        a = a + 1
    Loop
    Close #2
End Sub

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 labels dissapear mysteriously with Form_Paint
<SNIP>

Quote:

> Private Sub Form_DblClick()
>     GetPic
>     Call Form_Paint
> End Sub

<SNIP>

Perhaps try a Me.Refresh instead of "Call Form_Paint"

HTH,
Tom

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 labels dissapear mysteriously with Form_Paint
Thank you!  That did the trick.

Jennifer


Quote:

> <SNIP>

> > Private Sub Form_DblClick()
> >     GetPic
> >     Call Form_Paint
> > End Sub

> <SNIP>

> Perhaps try a Me.Refresh instead of "Call Form_Paint"

> HTH,
> Tom

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Form_Paint gets decoupled ???

2. Strange behavior of Form_Paint and X close button.

3. Form_Paint occurs 3 times?

4. Problem with MDI and Form_Paint

5. How to unload a form while its still busy with Form_Paint

6. Detecting WM_SYSCOLORCHANGE Message in Form_Paint

7. SelectClipRgn fails in Form_Paint()

8. records locked mysteriously

9. XP,Word 2002 : Mysteriously Conrols get into Design mode behaviour

10. page selection increments mysteriously

11. File Property data Mysteriously Changes

12. Tab Pages Mysteriously Reordered

 

 
Powered by phpBB® Forum Software