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

How to resize the background image of a form

Posted on 2011-09-23
5
287 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
5 Comments
 
LVL 6

Accepted Solution

by:
effes earned 250 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 83

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 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…

829 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