?
Solved

MDI Parent Form - Background Image Stretching

Posted on 2003-03-10
5
Medium Priority
?
1,678 Views
Last Modified: 2008-03-06
Is there anyway to set an image as the background of an MDI parent form in VB.Net, and have it stretch to fill the window?  I haven't seen anything anywhere to do this.  I am able to create a picture box over the form surface, but the child controls are then hidden.


0
Comment
Question by:raiderjakk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 28

Expert Comment

by:iboutchkine
ID: 8103874
I used this code for the Form background image. Maybe it will work for MDI parent (Inever tried)

' Paint an image loaded from a file directly on the form.
' This example hooks into the form's Paint event using the
' Handles clause.
'
Private Sub PaintImageOnForm( _
    ByVal sender As Object, _
    ByVal e As System.Windows.Forms.PaintEventArgs) _
    Handles MyBase.Paint

    e.Graphics.DrawImage( _
         Image.FromFile("C:\windows\web\wallpaper\wind.jpg"), 2, 2)

End Sub
0
 

Author Comment

by:raiderjakk
ID: 8104054
Nope.... that doesn't seem to do it.... MDI forms are special cases it seems.  :-)


0
 

Author Comment

by:raiderjakk
ID: 8113729
Actually, I figured out how to do this.

You can't subclass the paint event to get the graphics context because the background image isn't part of the signature for that event.  

Instead, I invoke a procedure that scales the image after a resize or move that redraws the background.  

The other oddity is that you have to have to refresh the parent form from within the child, otherwise, the image takes the forefront.

I will post code and accept the answer when I have it handy.  :-)


Thanks,

rj
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9671163
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9722731
PAQed, with points refunded (50)

Computer101
E-E Admin
0

Featured Post

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question