Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to resize the background image of a form

Posted on 2011-09-23
5
Medium Priority
?
293 Views
Last Modified: 2013-12-17
Dear Experts,

I have put a background image on a borderless form.
And wrote code to move and resize the form.
Everyting works great.

But when I resize the form the background image
doesn't resize too. In picture1 you see a borderless
form that hasn't resized yet. And picture 2 you see
what happens when you resize the form.

What can I fix this.?

Who knows the answer and is willing to help me?

Greetings,

Peter Kiers
Picture1.jpg
Picture2.jpg
0
Comment
Question by:peterkiers
[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 6

Accepted Solution

by:
effes earned 1000 total points
ID: 36589228
Hi Peter.
I assume this is a Windows  Forms project?
If yes, have you set the property "BackgroundImageLayout" from "Tile" to "Stretch"?

Hope that helps,
Frank
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 36589268
Background images are pixel for pixel and don't resize , at least until CSS3.  Here http://css-tricks.com/766-how-to-resizeable-background-image/ are some techniques but I don't know if they will apply to what you are trying to do.

What has traditionally been done is to make the background image a slice that is tall enough to cover any height that you want and then let it repeat in the x-direction.
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36589395
This is a Windows Form project.
and set the backgroundIMageLayout from Tile to scretch helps
but distor the image.

Peter Kiers
0
 
LVL 6

Expert Comment

by:effes
ID: 36589455
Sadly that's the effect when you stretch a bitmap.

If you just want to mimic a titlebar with the darker area at top you could put a panel there and give it the the color you want. Is that an option?
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 1000 total points
ID: 36589804
You could also just draw the titlebar area of the form in the Paint() event as a darker rectangle.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

609 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