实现如图所示功能:选择图片,然后拼到一个版面上,最后输出为一张大图
求思路,有例子不甚感激,要条件也行,谢谢
解决方案 »
- 正由另一进程访问的【进程】能查找出来的吗?
- 小弟有一个绑定<%#Eval("教师号")%>,求大侠鉴定
- 请教,请各位帮忙解答一下
- COMBOBOX
- 用一个登录名登录后,打开主页再打开注册表,如何在注册表的一个lable里显示当前登录名的ID啊?label.text = 查询的值.ToString()没用。
- C# 不能记录以前打开的项目
- .ocx控件注册问题
- 请问Server.UrlEncode是属于哪个命名空间?
- c#中timer_Tick()难以触发,高手指点(新手弱弱的问)
- 不知要学Winform还是WPF…
- c#程序按键盘没有反映
- 使用Winista.HtmlParser.dll出错的问题
涉及到层的概念判断鼠标落点,查找在该落点的所有图片,然后再判断该落点所有图片的Z-Index
然后根据Z-Index的大小值确定 选中的目标 ,然后更改 该图片的AllowMove 属性
移动鼠标 Move方法中判断AllowMove属性是否为true 如果为True 那就移动(跟着鼠标 画 )...
下面应该也就没什么难度了吧...
涉及到层的概念判断鼠标落点,查找在该落点的所有图片,然后再判断该落点所有图片的Z-Index
然后根据Z-Index的大小值确定 选中的目标 ,然后更改 该图片的AllowMove 属性
移动鼠标 Move方法中判断AllowMove属性是否为true 如果为True 那就移动(跟着鼠标 画 )...
下面应该也就没什么难度了吧...
兄弟说的是wpf吧,可惜我不会呀 T_T,能否指点指点
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);
}
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);
}
嗯嗯,判断相交已经会了,用rectangle1.IntersectWith(rectangle2),相交后呢?
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
}
}
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; }