Solved

How to resize the background image of a form

Posted on 2011-09-23
5
280 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 82

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now