//添加小块、中块 private void AddPicTile() { //添加小块 for (int i = 0; i < Rows; i++) { for (int j = 0; j < Rows; j++) { var p = new TilePic { Parent = pnlTile, Left = Gtg * i, Top = Gtg * j, Style = TileMode.Small, BackColor = UnSelColor }; p.DoubleClick += SendPicture; } } //添加中块 for (int k = 0; k < Rows - 1; k++) { for (int l = 0; l < Rows - 1; l++) { var p = new TilePic { Parent = pnlTile, Left = Gtg / 2 + Gtg * k, Top = Gtg / 2 + Gtg * l, SizeMode = PictureBoxSizeMode.StretchImage, Style = TileMode.Medium, BackColor = Color.Transparent }; p.DoubleClick += SendPicture; } } }
internal GumpItem(TilePic tp) { Location = new Point2D(tp.X, tp.Y); GraphicID = tp.Id; Color = 0; Page = tp.Page; ElementID = tp.ElemNum; }
//判断未选中中块是否与被选中块重叠(用中块中心位置判断) private static bool IsOverlap(TilePic pm, TilePic ps) { bool flag = pm.Left + SL / 2 < ps.Left - Gap / 2 || pm.Left + SL / 2 > ps.Right + Gap / 2 || pm.Top + SL / 2 < ps.Top - Gap / 2 || pm.Top + SL / 2 > ps.Bottom + Gap / 2; return(!flag); }