Results 1 to 2 of 2

Thread: [RESOLVED] MDI Form streched BackgroundImage not repainting when resizing on Windows Vista

  1. #1

    Thread Starter
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Resolved [RESOLVED] MDI Form streched BackgroundImage not repainting when resizing on Windows Vista

    I added an image (PNG file) as Backgroundimage to my MDI Form, this Form doesn't have any controls on it, BackgroundImageLayaout property is set to Stretch. It works perfectly on my computer (Windows XP), when I resize the MDI Form the Image inside is streched and refreshed. The Refreshing/repainting part is not happening on another computer with Windows Vista (it's a NoteBook), when the Form is maximized, the Picture inside is not refreshing, i have to move the Form outside screen and bring it back to force refresing/repainting. Streching doesn't seem to be a problem because when the image is refreshed (manually) it's streched as it should.

    I don't have this other computer here to test this but maybe calling Invalidate() somehwere may be useful? Maybe somebody else has been trough this in the past and can share some ideas.

    It's not something related to DoubleBuffering, MDI Forms have a DoubleBuffer property but actually it's not really implemented, nothing changes if it's set to True or not, so I added code to make real DoubleBuffering occur on this MDI Form, it certanly fixed flickering when the Form is moved, that's nice and i was hoping it would also fix this not refresing/repainting problem but it didn't.

    The image is a ~790kb PNG file, i made it using Photoshop: http://img835.imageshack.us/img835/4029/progfondo.png

    Thanks!
    Last edited by jcis; Jul 27th, 2012 at 05:20 PM.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: MDI Form streched BackgroundImage not repainting when resizing on Windows Vista

    Force the repaint ...

    vb Code:
    1. Private Sub Form1_Resize(sender As System.Object, e As System.EventArgs) Handles MyBase.Resize
    2.         Me.Refresh()
    3.     End Sub

    It won't do any harm if the auto repaint does trigger but it will solve the problem if it doesn't. MDI windows often have quirky behaviour so it's best to anticipate it.

Tags for this Thread

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