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
Solved

Need Help Freezing a Background Image On A Dialog Box With A Vertical Scroller in VB.NET

Posted on 2011-09-13
8
428 Views
Last Modified: 2012-08-14
Hello,

I am developing a PC application using Visual Studio 2008 with Visual Basic and .NET Framework 3.5.

My main form has a button which pops a dialog box.  The dialog box has a vertical scroller.  When I scroll, the background inage is leaving traces of itself where I scroll to.  The background image only has a small design at the upper left, and the rest of it is a solid color.  The background color of the dialog box has been set to that color in case the dialog contains more content than the background image can accomodate vertically.  The background image is loaded programmatically by the handler for the button on the main form that instantiates and pops the dialog.

Any help would be appreciated.

Thanks, Stu Engelman
0
Comment
Question by:stuengelman
  • 5
  • 2
8 Comments
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 36528532
Can you post your code and, better of all, the image?
0
 

Author Comment

by:stuengelman
ID: 36528698
Hi Roland,

The code to pop the dialog is shown in the code snippet section.

The background image is attached.

The background color for the popup is set at design time.

The BackgroundImageLayout property for the popup is set to "None" at design time.

Thanks, Stu
Dim T As Type = Type.GetType(Application.ProductName & "." & dlgname, True, True)
Dim f As Form = CType(Activator.CreateInstance(T), Form)
f.BackgroundImage = Image.FromFile(apppath & "/images/popuptemplate.jpg")
f.ShowDialog(Me)

Open in new window

popuptemplate.jpg
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36529207
Put a PictureBox control at the upper left and load the image in that PictureBox instead of setting it as the BackgroundImage.
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 

Author Comment

by:stuengelman
ID: 36529602
Hi James,

As long as I execute a SendToBack on the PictureBox, will there be any issue trying to render content (User and native controls) over the PictureBox, continuing to use the "me" predicate in instantiating them.  The basic idea is whether or not the controls have to be children of the PictureBox.

Thanks, Stu
0
 
LVL 40
ID: 36529806
If the PictureBox is in the back, there should not be any problem. No need to attach the controls to the PictureBox, just add them to the form as usual.

But a few little design notes.

Personnally, instead of using a big image, I would have only the image of the upper left corner in a small square. By loading the small bitmap in any good drawing program, you could get the exact value to use for the blue and use it as the BackColor to take care of the blue.

Instead of loading the picture from file, I would also incorporate it in the resources in my application. You will be able to do it by importing the bitmap as a Project resource file when adding the Image to the PictureBox throught the Properties window. The image will then be incorporated in the .exe. You won't have to distribute it with your application, and are sure that it will be available and will not be modified when displaying it.

Both of those could improve loading and display time, and using a smaller bitmap may make scrolling smoother.

0
 

Author Comment

by:stuengelman
ID: 36530372
James, great ideas, thanks.

Will try everything out.

Have been working since very early AM (US EST), and may need to get some rest.  If I don't reply back today, you'll hear from me tomorrow.

Thanks again for all your help.

Stu
0
 

Author Comment

by:stuengelman
ID: 36553824
James,

Your 09/13/11 08:05 AM post solved the problem!!

Great job.

Thanks, Stu
0
 

Author Closing Comment

by:stuengelman
ID: 36553827
Great solution, worked perfectly.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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