Results 1 to 7 of 7

Thread: Background Image on MDI Form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    688

    Background Image on MDI Form

    Hi

    How to display Background Image on MDI form & expand according to form size

    Thanks

  2. #2

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Background Image on MDI Form

    And then respond to the picturebox Resize event so you can redraw (PaintPicture) it to the new size as the MDI grows/shrinks
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Background Image on MDI Form

    One option I have used in the past is to use a WMF file for the background. If memory serves these will auto scale when used as the background image.

  5. #5
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: Background Image on MDI Form

    indeed, if the picture property of a form is a .WMF, it will fill the forms background

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Background Image on MDI Form

    And if non-proportional scaling is not a problem and WMF is not the image format, one could easily use a image control with Stretch property set to true within the picturebox. On the resize event, set the image control width/height to same as picbox's ScaleWidth/ScaleHeight or use PaintPicture, or the .Render method of the image. A few choices exist
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7
    gibra
    Guest

    Re: Background Image on MDI Form

    Quote Originally Posted by Jagjit View Post
    Hi

    How to display Background Image on MDI form & expand according to form size

    Thanks
    VB Helper: HowTo: Give an MDIForm a resizing background picture
    http://www.vb-helper.com/howto_mdi_b...d_picture.html


    If you want center image, replace this line:
    Code:
    picStretched.PaintPicture picOriginal.Picture, 0, 0, picStretched.ScaleWidth, _
        picStretched.ScaleHeight, 0, 0, picOriginal.ScaleWidth, picOriginal.ScaleHeight
    with this code:
    Code:
    Rem Center Image
    Dim x As Long, y As Long
    x = (ScaleWidth - picOriginal.Width) / 2
    y = (ScaleHeight - picOriginal.Height) / 2
    picStretched.PaintPicture picOriginal.Picture, x, y, picOriginal.Width, _
        picOriginal.Height, 0, 0, picOriginal.ScaleWidth, picOriginal.ScaleHeight
    Last edited by gibra; Apr 19th, 2015 at 03:16 PM.

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