public override void startSelect() { base.startSelect(); if (adjustButton1 == null) { adjustButton1 = new AdjustButton(Common.mainPicture, new Point(a.X - 3, a.Y - 3), Cursors.SizeNS); adjustButton1.MouseDown += AB_MouseDown; adjustButton1.MouseMove += AB_MouseMove; adjustButton1.MouseUp += AB_MouseUp; } if (adjustButton2 == null) { adjustButton2 = new AdjustButton(Common.mainPicture, new Point(b.X - 3, b.Y - 3), Cursors.SizeNS); adjustButton2.MouseDown += AB_MouseDown; adjustButton2.MouseMove += AB_MouseMove; adjustButton2.MouseUp += AB_MouseUp; } if (moveButton == null) { moveButton = new AdjustButton(Common.mainPicture, new Point((a.X + b.X) / 2 - 3, (a.Y + b.Y) / 2 - 3), Cursors.SizeAll); moveButton.BackColor = Color.Green; moveButton.MouseDown += MB_MouseDown; moveButton.MouseMove += MB_MouseMove; moveButton.MouseUp += MB_MouseUp; } if (rotateButton == null) { rotateButton = new RotateButton(Common.mainPicture, new Point((a.X + b.X) / 2, (a.Y + b.Y) / 2)); rotateButton.MouseDown += RB_MouseDown; rotateButton.MouseMove += RB_MouseMove; rotateButton.MouseUp += RB_MouseUp; } adjustButton1.setAllPoints( new Ref <Point>(() => a, z => { a = z; })); adjustButton2.setAllPoints( new Ref <Point>(() => b, z => { b = z; })); moveButton.setAllPoints( new Ref <Point>(() => a, z => { a = z; }), new Ref <Point>(() => b, z => { b = z; }), new Ref <Point>(() => adjustButton1.Location, z => { adjustButton1.Location = z; }), new Ref <Point>(() => adjustButton2.Location, z => { adjustButton2.Location = z; }), new Ref <Point>(() => rotateButton.Location, z => { rotateButton.Location = z; })); rotateButton.setAllPoints( new Ref <Point>(() => a, z => { a = z; }), new Ref <Point>(() => b, z => { b = z; })); drawRB2MB(); }
public override void startSelect() { base.startSelect(); int sumx = 0, sumy = 0; for (int i = 0; i < pointList.Count; ++i) { AdjustButton tmp = new AdjustButton(Common.mainPicture, new Point(pointList[i].X - 3, pointList[i].Y - 3), Cursors.SizeNS); //tmp.setAllPoints( // new Ref<Point>(() => pointList[i], z => { pointList[i] = z; })); tmp.MouseDown += AB_MouseDown; tmp.MouseMove += AB_MouseMove; tmp.MouseUp += AB_MouseUp; tmp.setAllPoints(); adjustButtonList.Add(tmp); sumx += pointList[i].X; sumy += pointList[i].Y; } if (moveButton == null) { moveButton = new AdjustButton(Common.mainPicture, new Point(sumx / pointList.Count - 3, sumy / pointList.Count - 3), Cursors.SizeAll); moveButton.BackColor = Color.Green; moveButton.MouseDown += MB_MouseDown; moveButton.MouseMove += MB_MouseMove; moveButton.MouseUp += MB_MouseUp; } if (rotateButton == null) { rotateButton = new RotateButton(Common.mainPicture, new Point(sumx / pointList.Count, sumy / pointList.Count)); rotateButton.MouseDown += RB_MouseDown; rotateButton.MouseMove += RB_MouseMove; rotateButton.MouseUp += RB_MouseUp; } midPoint = rotateButton.midPoint; moveButton.setAllPoints( new Ref <Point>(() => rotateButton.Location, z => { rotateButton.Location = z; })); rotateButton.setAllPoints( new Ref <Point>(() => a, z => { a = z; }), new Ref <Point>(() => b, z => { b = z; })); drawRB2MB(); }