473,799 Members | 3,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1510
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 SetImageSizeDif ference(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_RedrawImag e)
{
Graphics g = this.CreateGrap hics();
g.DrawImage(m_I mage, 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
1537
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 background image also needs to be zoomed in and zoomed out. the zoom factors ( zooming values are) 50%,100% and 150% how do i implement this? thanks in advance Gopi
0
1312
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 center or at least be in view. The code I am using know for centering isnt working correctly. AutoScrollPosition = new Point((int)(currentPoint.X * _zoom), (int)(currentPoint.Y * _zoom)); currentPoint is the last place I clicked. thanks
1
11656
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 turn the anti-aliasing off so I get a nice blocky icon image? -- "I have nothing but the greatest respect for other peoples' crackpot beliefs". -- Sam the Eagle.
0
1822
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 achieve the same task? Your help will be gretely appreciated. Thanks and Reagrds Pavan Joshi
2
1098
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 displaing map 2>displaing zoomin and 3> displaing zoomout in imagedisplay(of map) and event mouse move i have written the coding If zoomani = 1 Then Imgdisplay.MousePointer = LoadPicture(Apppath + "maps\zoomin.jpg") Else ...
4
10163
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 rectangles.The images are 2048x2048 pixels. It seems that I can find no efficient way to implement both zooming and panning. At present I have a panel with autoscroll set to true inside which there is
0
1620
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 thing is that the first zoom is really slow, and so is the first panning. So if you zoom into an image it will first take some time, and when trying to pan the image around things will be really choppy. However if i zoom into the image even more, and...
1
1242
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. Ex. Image + ABC Level1 + DEF level1 - GHI level1
4
8583
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
9540
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.