实现如图所示功能:选择图片,然后拼到一个版面上,最后输出为一张大图
求思路,有例子不甚感激,要条件也行,谢谢

解决方案 »

  1.   

    左边自定义控件,右边N个PictureBox,输出时建立所有Picturebox在一起时最大的区域,遍历每个PictureBox将图片按PictureBox坐标绘制到总图。
      

  2.   

    移动图片,就是鼠标的控制,这个你可以去搜索 C#移动 之类的信息,拼成大图,可以根据每个图片的位置,把他们draw到一个image上,然后将image输出
      

  3.   

    定义一个 自己的Frame 加上Z-Index属性
    涉及到层的概念判断鼠标落点,查找在该落点的所有图片,然后再判断该落点所有图片的Z-Index
    然后根据Z-Index的大小值确定 选中的目标 ,然后更改 该图片的AllowMove  属性
    移动鼠标 Move方法中判断AllowMove属性是否为true  如果为True 那就移动(跟着鼠标 画  )...
    下面应该也就没什么难度了吧...
      

  4.   

    定义一个 自己的Frame 加上Z-Index属性
    涉及到层的概念判断鼠标落点,查找在该落点的所有图片,然后再判断该落点所有图片的Z-Index
    然后根据Z-Index的大小值确定 选中的目标 ,然后更改 该图片的AllowMove  属性
    移动鼠标 Move方法中判断AllowMove属性是否为true  如果为True 那就移动(跟着鼠标 画  )...
    下面应该也就没什么难度了吧...
      

  5.   

    兄弟说的是WPF的吧,可惜我不会呀 T_T
      

  6.   


    兄弟说的是wpf吧,可惜我不会呀 T_T,能否指点指点
      

  7.   

    判断矩形是否相交函数如下,跟所有其他图片判断是否相交,相交就画虚框,没相交就找上、下、左、右最近的边看看是否需要碰撞处理
    protected bool CrossLine(Rectangle r1, Rectangle r2) {
                int x1, x2, x3, x4;
                int y1, y2, y3, y4;
                x1 = r1.X;
                x2 = r1.X + r1.Width;
                y1 = r1.Y;
                y2 = r1.Y + r1.Height;
                x3 = r2.X;
                x4 = r2.X + r2.Width;
                y3 = r2.Y;
                y4 = r2.Y + r2.Height;
                bool m = (x1 > x4) | (x2 < x3);
                bool n = (y2 < y3) | (y1 > y4);
                return !(m | n);
            }
      

  8.   

    判断矩形是否相交函数如下,跟所有其他图片判断是否相交,相交就画虚框,没相交就找上、下、左、右最近的边看看是否需要碰撞处理
    protected bool CrossLine(Rectangle r1, Rectangle r2) {
                int x1, x2, x3, x4;
                int y1, y2, y3, y4;
                x1 = r1.X;
                x2 = r1.X + r1.Width;
                y1 = r1.Y;
                y2 = r1.Y + r1.Height;
                x3 = r2.X;
                x4 = r2.X + r2.Width;
                y3 = r2.Y;
                y4 = r2.Y + r2.Height;
                bool m = (x1 > x4) | (x2 < x3);
                bool n = (y2 < y3) | (y1 > y4);
                return !(m | n);
            }
      

  9.   


    嗯嗯,判断相交已经会了,用rectangle1.IntersectWith(rectangle2),相交后呢?
      

  10.   

    给你设定了个类
        public class Frame : IDisposable
        {
            public Frame(int x,int y,int width, int height,Graphics g)
            {
                Img = new Bitmap(width, height);
                _Rectangle = new Rectangle(x, y, width, height);
                parentGraphics = g;
                ischange = true;
            }        private Image Img;        private int _Z_Index;
            public int Z_Index { get { return _Z_Index; } set { _Z_Index = value; ischange = true; } }        public Graphics parentGraphics { get; set; }
            public void Draw()
            {
                if (ischange)
                {
                    parentGraphics.DrawImage(Img, _Rectangle.Location);
                    ischange=false;
                }
            }        public bool ischange = false;        private Rectangle _Rectangle;
            public int X { get { return _Rectangle.X; } set { _Rectangle = new Rectangle(value, _Rectangle.Y, _Rectangle.Width, _Rectangle.Height); ischange = true; } }
            public int Y { get { return _Rectangle.Y; } set { _Rectangle = new Rectangle(_Rectangle.X, value, _Rectangle.Width, _Rectangle.Height); ischange = true; } }
            public int Width { get { return _Rectangle.Width; } }//set { _Rectangle = new Rectangle(_Rectangle.X, _Rectangle.Y, value, _Rectangle.Height); } }
            public int Height { get { return _Rectangle.Height; } }// set { _Rectangle = new Rectangle(_Rectangle.X, _Rectangle.Y, _Rectangle.Width, value); } }
            /// <summary>
            /// if this Is_collide with the destination image
            /// </summary>
            /// <param name="destination"></param>
            /// <returns></returns>
            public collide Is_collide(Frame destination)
            {
                Rectangle rcl=Rectangle.Intersect(destination._Rectangle, this._Rectangle);
                collide c;
                if (!rcl.IsEmpty)
                {
                    if (rcl.X > destination.X)
                    {
                        c = collide.right;
                    }
                    else if (rcl.X == destination.Y)
                    {
                        c = collide.equalX;
                    }
                    else
                    {
                        c = collide.left;
                    }
                    if (rcl.Y > destination.Y)
                    {
                        c = c | collide.down;
                    }
                    else if (rcl.Y == destination.Y)
                    {
                        c = c | collide.equalY;
                    }
                    else
                    {
                        c = c | collide.down;
                    }
                }
                else
                {
                    c = collide.no;
                }
                return c;
            }
            public void Dispose()
            {
                Img.Dispose();
                Img = null;
            }
            /// <summary>
            /// collide enum
            /// </summary>
            public enum collide : sbyte
            {
                no = 1,
                top = 2,
                right = 4,
                down = 8,
                left = 16,
                equalX = 32,
                equalY = 64
            }
        }
      

  11.   

    这里貌似小心过度了...  public int X { get { return _Rectangle.X; } set { _Rectangle = new Rectangle(value, _Rectangle.Y, _Rectangle.Width, _Rectangle.Height); ischange = true; } }
            public int Y { get { return _Rectangle.Y; } set { _Rectangle = new Rectangle(_Rectangle.X, value, _Rectangle.Width, _Rectangle.Height); ischange = true; } 只要这样就行了  public int X { get { return _Rectangle.X; } set { _Rectangle.X = value;ischange = true; } }
            public int Y { get { return _Rectangle.Y; } set { _Rectangle.Y= value;ischange = true; }