?
Solved

How to resize the background image of a form

Posted on 2011-09-23
5
Medium Priority
?
290 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

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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