Home All Groups Group Topic Archive Search About

Scaling a bitmap in a picturebox

Author
5 Aug 2006 7:22 PM
Eric
Hi,

I'm writing a program that based on input will create a document. It is
something simulair as a printing example.
In MS Word when you click on the shown document you can zoom in and if you
click again you'll zoom out again.

This is what I would like to do as well.
I draw the document in a bitmap, since all the information is drawn from a
database and on the form it is shown in a picturebox.

So what I'm trying to find out is how I can zoom in a certain factor by
clicking somewhere in the document.
If I use the SCALE method I can zoom in and out but how can I move the
bitmap so that the point clicked on is shown in the center of the
picturebox.

Please give me some directions on how to do this?

thanks,
Eric

Author
6 Aug 2006 7:13 PM
GhostInAK
Hello Eric,

Check out the PrintDocument class and the print preview features of the framework.

-Boo

Show quoteHide quote
> Hi,
>
> I'm writing a program that based on input will create a document. It
> is
> something simulair as a printing example.
> In MS Word when you click on the shown document you can zoom in and if
> you
> click again you'll zoom out again.
> This is what I would like to do as well.
> I draw the document in a bitmap, since all the information is drawn
> from a
> database and on the form it is shown in a picturebox.
> So what I'm trying to find out is how I can zoom in a certain factor
> by
> clicking somewhere in the document.
> If I use the SCALE method I can zoom in and out but how can I move the
> bitmap so that the point clicked on is shown in the center of the
> picturebox.
> Please give me some directions on how to do this?
>
> thanks,
> Eric
Author
7 Aug 2006 9:14 AM
Bob Powell [MVP]
Zoompicbox, an article on my site, will help you get started with this.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



Show quoteHide quote
"Eric" <some***@MicroZoft.com> wrote in message
news:44d4efdb$0$2030$ba620dc5@text.nova.planet.nl...
> Hi,
>
> I'm writing a program that based on input will create a document. It is
> something simulair as a printing example.
> In MS Word when you click on the shown document you can zoom in and if you
> click again you'll zoom out again.
>
> This is what I would like to do as well.
> I draw the document in a bitmap, since all the information is drawn from a
> database and on the form it is shown in a picturebox.
>
> So what I'm trying to find out is how I can zoom in a certain factor by
> clicking somewhere in the document.
> If I use the SCALE method I can zoom in and out but how can I move the
> bitmap so that the point clicked on is shown in the center of the
> picturebox.
>
> Please give me some directions on how to do this?
>
> thanks,
> Eric
>
>