473,406 Members | 2,956 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,406 software developers and data experts.

How to zoom in on a image with Zoom button?

82
Hi, Im trying to zoom in on an image. First I make a .bmp from the picturebox.image the make the.bmp bigger the put the new .bmp back into the picturebox. All this does is make my image disappear.Why?

Expand|Select|Wrap|Line Numbers
  1.   private void btnZoomIn_Click(object sender, EventArgs e)
  2.         {
  3.             Bitmap a = new Bitmap(pictureBox1.Image.Height * 2, pictureBox1.Image.Width * 2);  
  4.             pictureBox1.Image = a; 
  5.  
  6.         }
Dec 9 '10 #1
2 5447
hype261
207 100+
The reason that your Bitmap disappears is because you just constructed a blank Bitmap with a specific size. None of the data in the original bitmap is being used. The constructor you want to use is.

Expand|Select|Wrap|Line Numbers
  1. Size newSize = new Size(pictureBox1.Image,Width *2,pictureBox1.Image.Height *2 );
  2. Bitmap a = new Bitmap(pictureBox1.Image,newSize);
This will scale your original bitmap up to that size
Dec 9 '10 #2
mrcw
82
thanks for that. Why doesn't it work when scalar = 50 instead of 2?
Dec 9 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Deano | last post by:
I think that just about sums it up. Is there a fix/workaround for this?It's quite annoying behaviour and not user-friendly.thanksMartin
2
by: Marie | last post by:
When a report is open in preview mode, you can go to the Zoom button on the toolbar at the top of the screen, type in a zoom percent different from what is in the list and the magnification changes...
3
by: Boni | last post by:
Dear all, I need a picturebox on which I can with GDI+ draw rectangles. The scroll and zoom should be supported. Do I have to manually resize rectangles,when zoom button clicked and change...
4
by: riscy | last post by:
I have a button with mouse_click event when pushed. However it does not generates mouse down event. To fix this I could poll the mouse state every 10mSec and see if the mouse button remains down...
0
by: RickL | last post by:
Hi, I'm fairly new to web application development and I'm creating an application for camera control, which leads to the question. I want to create a button that can respond to mouse down and...
4
by: prami | last post by:
Hello I'm sure I do something wrong, but I don't know what ... In Form 1 I painted the RTF2 control and bound it to a memo field. Entering and changing data therein works fine. Now, based on...
1
by: mrjoka | last post by:
hi guys i have a work it was first implemented with the drop down list: <select name="zoom" onChange="showMap(this.form)"> <option value=7 <% if zoom = 7 then %>selected<% end if %>>Provincie...
4
by: rakeshvthu | last post by:
Hi All, I have a requirement my Customer doesn't want to see any changes in the page when user clicks on Zoom button in IE7 or in any other browser that supports Zoom option. Can you please help...
0
by: overbrain | last post by:
Hello guys. I want to create a HTML on webbrowser control with zoom button. Is it possible in VB.NET?
5
by: Daniish | last post by:
Hello, I want to include a bit of text in my Google Map Infowindow - that when clicked maximises the infowindow. This is the code for maximising the infowindow map.getInfoWindow().maximize();...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
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...

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.