地图用户控件.显示多个图像和缩放图像的组合. [英] map user control.Displaying combination of multiple images and zooming images.

查看:70
本文介绍了地图用户控件.显示多个图像和缩放图像的组合.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个96 * 96像素的PictureBox控件.我想在此控件中显示9个32 * 32像素的位图,这些图以3X3的正方形排列.当我单击
上的点时, 应该缩放的图像,这样就不会丢失像素,因为有3 * 3的图像.
因为我要显示哪些图像以及每个图像显示了多少部分?

I have a PictureBox Control which is 96*96 pixels. I want to display nine 32*32 pixel bitmaps in this control arranged in a 3X3 square.and when i click a point on
that that should be zoomed.so that it will not lose pixel as there are 3*3 images.
as i will take which images and how much portion from each image is displayed

推荐答案

为什么不将9个位图组合成一个图像,然后工作
Why don''t you assemble the nine individual bitmaps into a single image, and work with that instead?


那么,您将无法向PictureBox控件添加九个不同的图像.您只能显示一张图片!作为替代方案,您可以使用九个单独的图片框,它们都放置在一起.即

Well you are not going to be able to add nine different images to a PictureBox control. You can only show one image! As an alternative you could use nine seperate picture boxes all positioned together. i.e.

Point posOnForm = new Point(20, 20);
int picBoxWidth = 32;
int picBoxHeight = 32;

PictureBox[,] picBoxes = new PictureBox[3, 3];
for (int i = 0; i < picBoxes.GetLength(0); i++)
{
    for (int n = 0; n < picBoxes.GetLength(1); n++)
    {
        picBoxes[i, n] = new PictureBox();

        picBoxes[i, n].Parent = this;

        picBoxes[i, n].Size = new System.Drawing.Size(picBoxWidth, picBoxHeight);

        picBoxes[i, n].Location = new Point(
            posOnForm.X + (n * picBoxWidth),
            posOnForm.Y + (i * picBoxHeight));

        //picBoxes[i, n].Image = someImg;
        // OR
        picBoxes[i, n].ImageLocation = "myimg.png";
    }
}



对于缩放,Google是您的朋友



And for zooming Google is your friend
how to zoom image c#[^]


这篇关于地图用户控件.显示多个图像和缩放图像的组合.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆