473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Zooming images

Hi,

currently I am programming a control to zoom in/out images and move them
inside a frame, but when I zoom it keeps the upper left corner static making
the image growing to the lower-rigth direction... I would like to make the
the image fixed on the center of the frame expanding it to all the sides from
that point....

Guess that ou can figure out what I want (forgive my bad english)

I would like so code or tutorial if possible

Thanks in advance
Nov 17 '05 #1
1 1456
once you have resized your image, you will have to reset it's origin, for
example

private Bitmap m_Image;
private bool m_RedrawImage = false;
private int m_Top = 0;
private int m_Left = 0;

private void SetImageSizeDifference(int origWidth, int origHeight, bool zoom)
{
m_Left -= (m_Image.Width - origWidth);
m_Top -= (m_Image.Height - origHeight);
m_RedrawImage = true;
Refresh();
}

override public void OnPaint(object sender, PaintEventArgs e)
{
if(m_RedrawImage)
{
Graphics g = this.CreateGraphics();
g.DrawImage(m_Image, m_Left, m_Top);
m_RedrawImage = false;
}
}

--
Of all words of tongue and pen, the saddest are: "It might have been"

Bill.Richards @ greyskin .co .uk
http://greyskin.co.uk
"Diogo Alves - Software Developer" wrote:
Hi,

currently I am programming a control to zoom in/out images and move them
inside a frame, but when I zoom it keeps the upper left corner static making
the image growing to the lower-rigth direction... I would like to make the
the image fixed on the center of the frame expanding it to all the sides from
that point....

Guess that ou can figure out what I want (forgive my bad english)

I would like so code or tutorial if possible

Thanks in advance

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gopi | last post by:
Hi All I have set a BackgroundImage for windows forms and i need to implement the image zooming feature for the form ie when ever i m zooming in or zooming out the form the corrosponding...
0
by: gerstla | last post by:
hi I am building a simple control to view images with zooming capabilities. i want the image to zoom when it is clicked on. after zooming i want the control to try and move the point clicked to the...
1
by: John | last post by:
I have an app where I want to show an icon in a large PictureBox. I've set the SizeMode to Zoom but the icon image is extremely fuzzy because the scaling up also anti-aliases. Is there a way to...
0
by: pavanjosh | last post by:
Hello Frineds, Can anyone please help me in getting the code or library for written in C# for zooming in and zooming out the images in the picture box? Or is there any other way from which i can...
2
by: Aniket Singh | last post by:
i m doing project in VB what i want is when i wll click on zoomin and take mouse pointer over the map it should show zoomin image and same zoom out in my project there r three images. 1> image...
4
by: =?Utf-8?B?U3BlZWR5?= | last post by:
Hi there, I am currently writing an application where one inspects images and annotates certain features. Thus, one has to zoom in (4x) and pan around. The features are marked with little red...
0
by: johot | last post by:
I am currently creating a little photo application. In this application the user is able to zoom in the image and after zooming panning around inside the zoomed image with the mouse. The strange...
1
by: pavanip | last post by:
Hi, I am doing a simple application Zooming Image. Here I am taking an image and dividing that image into different regions. I have a tree structure of different levels like this. ...
4
by: alarock | last post by:
how can i do Zooming of a particular area using OnMouseWheel (that is zooming a mouse wheel point that should come into view with zoom ) using C# Regards, ALGATES
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.