4

画像をズームインおよびズームアウトするには、pictureBox のサイズを変更し、ストレッチモードで画像を表示する方法があります。一般的に8xを超えるとストレージエラーが発生するため、効率的に使用できませんが[pictureBoxのサイズ(32k、32k)が1GB以上のメモリを必要とすることを考えてください!

特別な方法はありますか、または ImageClone を使用して画像の見える部分のみをズームする必要がありますか?

アップデート:

これは、最初にプロジェクトをズームしようとするプロジェクトです [不可能、ストレージエラー] form.cs の 41. 行を削除します。

pictureBox1.Image = youPicture;

この行を削除すると、プログラムが動作するようになります。拡大した画像を移動してください。

リンクは次のとおりです。 http://rapidshare.com/files/265835370/zoomMatrix.rar.html

4

3 に答える 3

3

By using the matrix object and the transform property of your graphics object:

using(Graphics g = this.CreateGraphics())
{
    using(Bitmap youPicture = new Bitmap(yourPictureFile))
    {
        g.DrawImage(youPicture, 0, 0, 300, 100); //set the desired size

        //Now you need to create a matrix object to apply transformation on your graphic
        Matrix mat = new Matrix();
        mat.Scale(1.5f, 1.5f, MatrixOrder.Append); //zoom to 150%
        g.Transform = mat;

        g.DrawImage(youPicture, new Rectangle(...), 0, 0, youPicture.Width,
            youPicture.Height, GraphicsUnit.Pixel) ;
    }
}
于 2009-08-07T12:48:39.947 に答える
1

残りはとにかく隠されているので、私は個人的に表示部分をズームするだけです(したがって役に立たない)

于 2009-08-07T12:38:48.993 に答える
1

See this answer to an earlier question. You definitely don't want to zoom by making the image huge and showing only part of it - you'll run into the memory problem that you've already encountered. Also, the stretch mode of a picture box doesn't use high-quality interpolation, so the result will look pretty crappy.

In the answer I linked here, I included a link to a C# project that shows you how to do this kind of zooming.

Update: here is a direct link to the downloadable project.

于 2009-08-07T12:50:03.520 に答える