Beispiel #1
0
        private void LayoutDrug(object sender, DrugEventArgs args)
        {
            var layout = sender as MyLayout;

            if (!LineConnectionflug)
            {
                /* Viewの移動 */
                MoveView(layout, args.X, args.Y);

                /* 動かしたViewがつながっているLineCanvas.Lineインスタンスの一覧を取得 */
                var lines = Canvas.SearchLines(layout);

                foreach (var l in lines)
                {
                    l.Draw();
                }

                var rc = Canvas.Bounds;

                /* Canvasの拡張 */
                if (rc.Width < layout.X + layout.Width)
                {
                    rc.Width = layout.X + layout.Width;
                }

                if (rc.Height < layout.Y + layout.Height)
                {
                    rc.Height = layout.Y + layout.Height;
                }

                Canvas.LayoutTo(rc, 0);

                DbInsertListTb2[layout.PartsId].position_x = "";
                DbInsertListTb2[layout.PartsId].position_y = "";
            }
            else
            {
                /*線を引くモード*/
                if (LineConnectionStack.Contains(layout))
                {
                    //layout.BackgroundColor = Color.Black;
                    //LineConnectionStack.Pop();
                    //Debug.WriteLine("同じなのでだしました");
                }
                else
                {
                    if (LineConnectionStack.Count == 0)
                    {
                        layout.BackgroundColor = Color.Red;
                        LineConnectionStack.Push(layout);
                        Debug.WriteLine("一つ目を追加");
                    }
                    else
                    {
                        View layout2 = LineConnectionStack.Peek();
                        layout2.BackgroundColor = Color.Black;
                        LineConnectionStack.Pop();
                        LineConnectionStack.Clear();
                        Debug.WriteLine("2つ目を追加および線");
                        LineConnectionflug = false;

                        var line = Canvas.Tail(layout2, layout);

                        line.Draw();
                    }
                }
            }

            //if (!layout.DrugFlag)
            //{
            //    return;
            //}

            //if ((layout.TranslationX + args.X) < 0)
            //{
            //    return;
            //}

            //if ((layout.TranslationX + args.X + layout.Width) > Canvas.Width)
            //{
            //    return;
            //}

            //layout.TranslationX += args.X;

            //if ((layout.TranslationY + args.Y) < 0)
            //{
            //    return;
            //}

            //if ((layout.TranslationY + args.Y + layout.Height) > Canvas.Height)
            //{
            //    return;
            //}

            //layout.TranslationY += args.Y;
        }
Beispiel #2
0
 /// <summary>
 /// LineCanvasインスタンスのドラッグ用イベント。
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="args">Arguments.</param>
 private void CanvasDrug(object sender, DrugEventArgs args)
 {
 }
Beispiel #3
0
 public void Drug(object sender, DrugEventArgs args)
 {
     this.TranslateTo(args.X, args.Y, 0);
 }