Bob, is some of the vs2005 help wrong? for example:
Graphics.DrawImage Method (Image, Point[])
Draws the specified Image at the specified location and with the specified
shape and size.
There is no specified size, and what does specified shape mean?
=========New subject=========
The VS doc says for the one you specified:
Graphics.DrawImage Method (Image, Int32, Int32)
Draws the specified image, using its original physical size, at the location
specified by a coordinate pair.
I believe that Scales the image using (Screen DPI/ Image DPI) so it appears
on the screen with the correct (inches) dimension. Correct?
There is also one that
Graphics.DrawImageUnscaled Method (Image, Point)
Draws a specified image using its original physical size at a specified
location.
The text is the same, does it do the same thing?
I realize now that I asked you for the wrong thing last time.
I really (now) want the image to fit in the (500,500) bitmap in your example
below. That is, either the height or width should be 500. I know about
Graphics.DrawImage Method (Image, Single, Single, Single, Single)
Draws the specified Image at the specified location and with the specified
size.
Is that the best way to go (where the width=500 and the Height<=500, or
width<=500 and the Height=500)
Thanks a lot
[quoted text, click to view] "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:%23AoxpfNbHHA.5052@TK2MSFTNGP05.phx.gbl...
> The point is that GDI+ does indeed do the scaling for you.
>
> If you use DrawImage without the full specification of source ad
> destination rectangle the software takes the resolution into account
> automatically.
>
> In fact, I think you're the first person I've seen who has complained
> about the size issue and not said "I have an image with 2000 * 3000
> pixels, why does it draw so small??"
>
> Try drawing the image with DrawImage(image,x,y) and see.
>
> Oh, and stop using CreateGraphics and stop overriding PictureBox paint..
> try this instead...
>
> Bitmap bm=new Bitmap(500,500);
> Graphics g=Graphics.FromImage(bm);
> g.DrawImage(<your high res image>,0,0);
> pictureBox1.Image=bm;
>
>
> --
> 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.
>
>
>
>
>
> Oliver Sturm wrote:
>> Hello,
>>
>>> Thanks, I can do the calculations but wondered if images had imbedded in
>>> them info about their size
>>
>> I believe that is in fact the case with many common graphics formats, but
>> I don't know anything about the details. This would also vary with the
>> format you use.
>>
>>> that would essentially cause the conversion to the display.
>>
>> It wouldn't "cause" it - I don't think there's a standard control
>> available that would automatically read that info and do the scaling and
>> displaying for you. But of course that information could be used for your
>> purpose - I was actually assuming when I read your original question that
>> you already had that info, probably from the source we were just
>> discussing.
>>
>>> So if I have a file containing an image intended for a printer I really
>>> can't display it without some pixel merging or it will display much
>>> bigger then it will print.
>>
>> Right. Of course. If the image contains far more pixel information than
>> you can display on your screen, there's really nothing you can do about
>> it, other dropping or merging some of it.
>>
>>
>>
>> Oliver Sturm