[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Print image, scaled to fit

Becker

12/14/2004 5:45:00 PM

How can I take an image and print it scaling it to fit on a page? E.g. if
the image is bigger than a page, I want it to shrink to fit the page, if it
is smaller than a page, I want it to grow to the size of the page?

My problem is that I have a picture box with an image in there (I can set it
to stretch and it fits nicely). When I go to print it using a method like
this:

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawImageUnscaled(Me.PictureBox1.Image, 0, 0)

End Sub

It ends up taking my image and scaling it strangely on the paper.

Any ideas?


6 Answers

Bob Powell

12/14/2004 7:36:00 PM

0

Take a look at the article in the GDI+ FAQ that deals with best-fit
algorithm drawing. The transform used will scale up as well as down. it also
maintains the image aspect ratio so there is no distortion of the output
image.

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

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

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

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





"Becker" <ben@benbecker.net> wrote in message
news:eK8RaSg4EHA.1596@tk2msftngp13.phx.gbl...
> How can I take an image and print it scaling it to fit on a page? E.g. if
> the image is bigger than a page, I want it to shrink to fit the page, if
it
> is smaller than a page, I want it to grow to the size of the page?
>
> My problem is that I have a picture box with an image in there (I can set
it
> to stretch and it fits nicely). When I go to print it using a method like
> this:
>
> Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
> System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
> e.Graphics.DrawImageUnscaled(Me.PictureBox1.Image, 0, 0)
>
> End Sub
>
> It ends up taking my image and scaling it strangely on the paper.
>
> Any ideas?
>
>


Becker

12/14/2004 8:02:00 PM

0

Thanks Bob! I am having the worst time with drawimage and my TIFFS. The
tiffs size elements are huge. They go beyond the actual size of the image
contained in them so I get dead space between the image and the edge of the
actual image.

I got it to work ok doing this which draws it to a rectangle.

e.Graphics.DrawImage(imgList1(currentPage), New Rectangle(25, 25, 800,
1050))

The only problem I have now is printing multiple pages. When I call my
document.print, it only prints 1 page.



"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:%23Ejv8Qh4EHA.3376@TK2MSFTNGP12.phx.gbl...
> Take a look at the article in the GDI+ FAQ that deals with best-fit
> algorithm drawing. The transform used will scale up as well as down. it
> also
> maintains the image aspect ratio so there is no distortion of the output
> image.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Becker" <ben@benbecker.net> wrote in message
> news:eK8RaSg4EHA.1596@tk2msftngp13.phx.gbl...
>> How can I take an image and print it scaling it to fit on a page? E.g.
>> if
>> the image is bigger than a page, I want it to shrink to fit the page, if
> it
>> is smaller than a page, I want it to grow to the size of the page?
>>
>> My problem is that I have a picture box with an image in there (I can set
> it
>> to stretch and it fits nicely). When I go to print it using a method
>> like
>> this:
>>
>> Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
>> System.Drawing.Printing.PrintPageEventArgs) Handles
> PrintDocument1.PrintPage
>> e.Graphics.DrawImageUnscaled(Me.PictureBox1.Image, 0, 0)
>>
>> End Sub
>>
>> It ends up taking my image and scaling it strangely on the paper.
>>
>> Any ideas?
>>
>>
>
>


Bob Powell

12/14/2004 8:15:00 PM

0

I guess this is multi-page tiff yes? When you print a page be sure to set
HasMorePages to true unless of course it's the last page.

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

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

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

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





"Becker" <ben@benbecker.net> wrote in message
news:%231MEEfh4EHA.3864@TK2MSFTNGP15.phx.gbl...
> Thanks Bob! I am having the worst time with drawimage and my TIFFS. The
> tiffs size elements are huge. They go beyond the actual size of the image
> contained in them so I get dead space between the image and the edge of
the
> actual image.
>
> I got it to work ok doing this which draws it to a rectangle.
>
> e.Graphics.DrawImage(imgList1(currentPage), New Rectangle(25, 25, 800,
> 1050))
>
> The only problem I have now is printing multiple pages. When I call my
> document.print, it only prints 1 page.
>
>
>
> "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> news:%23Ejv8Qh4EHA.3376@TK2MSFTNGP12.phx.gbl...
> > Take a look at the article in the GDI+ FAQ that deals with best-fit
> > algorithm drawing. The transform used will scale up as well as down. it
> > also
> > maintains the image aspect ratio so there is no distortion of the output
> > image.
> >
> > --
> > Bob Powell [MVP]
> > Visual C#, System.Drawing
> >
> > Find great Windows Forms articles in Windows Forms Tips and Tricks
> > http://www.bobpowell.net/tips...
> >
> > Answer those GDI+ questions with the GDI+ FAQ
> > http://www.bobpowell.net/f...
> >
> > All new articles provide code in C# and VB.NET.
> > Subscribe to the RSS feeds provided and never miss a new article.
> >
> >
> >
> >
> >
> > "Becker" <ben@benbecker.net> wrote in message
> > news:eK8RaSg4EHA.1596@tk2msftngp13.phx.gbl...
> >> How can I take an image and print it scaling it to fit on a page? E.g.
> >> if
> >> the image is bigger than a page, I want it to shrink to fit the page,
if
> > it
> >> is smaller than a page, I want it to grow to the size of the page?
> >>
> >> My problem is that I have a picture box with an image in there (I can
set
> > it
> >> to stretch and it fits nicely). When I go to print it using a method
> >> like
> >> this:
> >>
> >> Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
> >> System.Drawing.Printing.PrintPageEventArgs) Handles
> > PrintDocument1.PrintPage
> >> e.Graphics.DrawImageUnscaled(Me.PictureBox1.Image, 0, 0)
> >>
> >> End Sub
> >>
> >> It ends up taking my image and scaling it strangely on the paper.
> >>
> >> Any ideas?
> >>
> >>
> >
> >
>
>


Becker

12/14/2004 9:18:00 PM

0

Got it! Thanks for all your help. I'm finding your site to be extremely
useful and very well put together.


"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:OFNxomh4EHA.1400@TK2MSFTNGP11.phx.gbl...
>I guess this is multi-page tiff yes? When you print a page be sure to set
> HasMorePages to true unless of course it's the last page.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Becker" <ben@benbecker.net> wrote in message
> news:%231MEEfh4EHA.3864@TK2MSFTNGP15.phx.gbl...
>> Thanks Bob! I am having the worst time with drawimage and my TIFFS. The
>> tiffs size elements are huge. They go beyond the actual size of the
>> image
>> contained in them so I get dead space between the image and the edge of
> the
>> actual image.
>>
>> I got it to work ok doing this which draws it to a rectangle.
>>
>> e.Graphics.DrawImage(imgList1(currentPage), New Rectangle(25, 25, 800,
>> 1050))
>>
>> The only problem I have now is printing multiple pages. When I call my
>> document.print, it only prints 1 page.
>>
>>
>>
>> "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
>> news:%23Ejv8Qh4EHA.3376@TK2MSFTNGP12.phx.gbl...
>> > Take a look at the article in the GDI+ FAQ that deals with best-fit
>> > algorithm drawing. The transform used will scale up as well as down. it
>> > also
>> > maintains the image aspect ratio so there is no distortion of the
>> > output
>> > image.
>> >
>> > --
>> > Bob Powell [MVP]
>> > Visual C#, System.Drawing
>> >
>> > Find great Windows Forms articles in Windows Forms Tips and Tricks
>> > http://www.bobpowell.net/tips...
>> >
>> > Answer those GDI+ questions with the GDI+ FAQ
>> > http://www.bobpowell.net/f...
>> >
>> > All new articles provide code in C# and VB.NET.
>> > Subscribe to the RSS feeds provided and never miss a new article.
>> >
>> >
>> >
>> >
>> >
>> > "Becker" <ben@benbecker.net> wrote in message
>> > news:eK8RaSg4EHA.1596@tk2msftngp13.phx.gbl...
>> >> How can I take an image and print it scaling it to fit on a page?
>> >> E.g.
>> >> if
>> >> the image is bigger than a page, I want it to shrink to fit the page,
> if
>> > it
>> >> is smaller than a page, I want it to grow to the size of the page?
>> >>
>> >> My problem is that I have a picture box with an image in there (I can
> set
>> > it
>> >> to stretch and it fits nicely). When I go to print it using a method
>> >> like
>> >> this:
>> >>
>> >> Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e
>> >> As
>> >> System.Drawing.Printing.PrintPageEventArgs) Handles
>> > PrintDocument1.PrintPage
>> >> e.Graphics.DrawImageUnscaled(Me.PictureBox1.Image, 0, 0)
>> >>
>> >> End Sub
>> >>
>> >> It ends up taking my image and scaling it strangely on the paper.
>> >>
>> >> Any ideas?
>> >>
>> >>
>> >
>> >
>>
>>
>
>


HHW

6/10/2013 6:05:00 PM

0

On Jun 10, 10:14 am, mirjam <mir...@actcom.co.il> wrote:
> On Monday, June 10, 2013 2:01:12 AM UTC+3, HHW wrote:
>
> You wrote the next  sentence
>
> > > > , were it not for Zionism, an overarching, man-made
> > > > political ideology,
>
> You explain what you meant ,,,,, As far as I know ALL IDEOLOGIES are man made so why mention this as you did ????

I mentioned it to make clear to you, a true believer, that all
essentially utopian political ideologies are as hopelessly flawed as
their "out of Africa" authors and are therefore not just wrong but
dangerous.

All of them represent attempts to impose an imagined order on the
future. Yet all of them are subject to the inescapable law of
unintended consequences. And this is true precisely because they
represent the efforts of mere humans, the descendants of apes, to
control a future in which there are far too many unknowns and
variables affecting the project. It is an impossible project. I
suggest you watch the film "Brazil".

When these exciting ideas were naught but philosophical speculation,
little harm was done, Plato, More, etc. But with the advent of the
European socialist tradition of which Zionism is a minor residual
part, the results became catastrophic and they were all abject
failures at the cost of scores of millions of innocent lives destroyed
completely independent of the endemic warfare.

It was a combination of fanaticized ideology with centralized state
power which produced so much bloodshed, ruined lives and destitution.
Marxism/Leninism in the Soviet Union and Eastern Europe crashed in a
sanguinary mess. Maoism was a catastrophe rescued from even worse by a
few party members, a phenomenon which seems to have been more or less
accidental. National Socialism, projecting itself out to a thousand
years, lasted twelve, but at a cost you well understand. Yugoslav
socialism has crashed and the state is broken up on a medieval
pattern. Pol Potism made a living hell out of a charmingly provincial,
Buddhist Cambodia. And then there was Vietnam in which you can see
reflections of my attitude toward the effects of radical political
ideologies on the United States.

Against this 20th Century background Zionism is somewhat unique. Its
democratic socialist, even communist, tendencies were somewhat muted
even in the beginning and now, except for land tenure, seem to have
evaporated. It's an ethnic capitalist state. What's left on its agenda
is only the Palestinian (think Jewish) problem and a totalitarian
temptation as to its solution.

Israel as a matter of fact is colonial, elitist, racist and
militaristic. These tendencies were also characteristic of National
Socialism. Zionism in power was the product of previous racist crimes
in Europe, so that in the experiential sense this is not surprising.
And yet Zionists made the grievous error of seeking utopia in a region
not even friendly to democracy, much less further intrusions by
colonialists.

Israel is racing into a tunnel with no idea what she will find when
she awakens on the other side. She is hurt a lot by her people's
native hubris and by her success in occupying the American government
in the above-described project.

> > > So your ideology is machine made?

I'm no scholar, mirjam, but I've been interested in the central
problem you represent for a long time. It has the look of a disaster
from which the U.S. most likely will not be able to protect you and,
after decades of abuse by American Zionists, she may not even have the
will to try.



> > > mirjam
>
> > You'll have to explain how you came to that.

mirjam

6/11/2013 4:55:00 AM

0

On Monday, June 10, 2013 9:04:57 PM UTC+3, HHW wrote:

I have answered this letter in two other places ,,, do you think that if you spread the same letter over several different subject lines and in 2 groups , than it will make it more real ..

Here i summerize my answer for you .. look it up in any of the other places you posted this
>
> I mentioned it to make clear to you, a true believer,
I am not a believer of any ideology, Since yesterday i can`t stop smiling about the Total lack of minimal understanding you have for any Human concepts.

I have learned from my life experiences, and try to live by them.
as a Zionist i believe all people to be Equal and have the same rights, which Includes me , Just like you i have the right to live according to my Cultural and national heritage.
i deleted all the rest of your writing, which is an embarrassing collection of sentences.
mirjam