Beispiel #1
0
 private void init()
 {
     this.modified        = false;
     this.multiSelected   = new ArrayList();
     this.selectedShape   = null;
     this.tempLine        = null;
     this.arrowLong       = 10.0;
     this.arrowAngle      = 0.52359877559829882;
     this.isCaptured      = false;
     this.wantLine        = false;
     this.breakLine       = false;
     this.wantMoveShape   = false;
     this.wantMovePoint   = -1;
     this.wantInput       = false;
     this.inputBox        = new TextBox();
     this.turningPosition = -2;
     this.CursorFlag      = true;
     this.RecFlag         = false;
     this.ReserveFlag     = false;
     this.CursorDown      = false;
     this.RecDown         = false;
     this.ReserveDown     = false;
     this.myPen           = new Pen(Color.Black);
     this.dataDoc         = new VMDoc1((DEViewModel)this.mainWindow.Tag);
     this.BackColor       = SystemColors.Window;
     base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     base.SetStyle(ControlStyles.UserPaint, true);
     base.SetStyle(ControlStyles.DoubleBuffer, true);
     this.inputBox.KeyDown += new KeyEventHandler(this.inputBox_KeyDown);
 }
Beispiel #2
0
 private void VMView_MouseUp(object sender, MouseEventArgs e)
 {
     this.mousePosition = new Point(e.X, e.Y);
     if (e.Button == MouseButtons.Left)
     {
         this.isCaptured = false;
         if (this.wantLine)
         {
             this.endShape = this.inShape(this.mousePosition);
             if (((this.endShape != null) && !(this.endShape is VMText1)) && (this.startShape != this.endShape))
             {
                 ErrorDetective1 detective = new ErrorDetective1(this.dataDoc, this.startShape, this.endShape);
                 if (detective.ErrorFree())
                 {
                     VMLine1 line = new VMLine1(Guid.NewGuid(), this.startShape, this.endShape);
                     this.addLine(line);
                 }
                 else
                 {
                     MessageBox.Show("逻辑错误!!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 }
                 this.startShape = null;
                 this.endShape   = null;
             }
             this.wantLine = false;
             this.moveBase = this.mousePosition;
         }
         else if (this.RecFlag)
         {
             VMNode1 node = new VMNode1(Guid.NewGuid(), this.mousePosition);
             if (this.selectedShape != null)
             {
                 this.selectedShape.isSelected = false;
             }
             this.selectedShape = node;
             this.addNode(node);
             this.RecFlag = false;
             this.mainWindow.controlTBButton(TagForViewWork.TOOLBAR_REC);
             this.moveBase = this.mousePosition;
         }
         else if (this.breakLine && (this.turningPosition != -2))
         {
             this.addPoint(this.turningPosition, this.mousePosition);
             this.breakLine       = false;
             this.turningPosition = -2;
             this.moveBase        = this.mousePosition;
         }
         else if (this.wantMulSelect)
         {
             Rectangle rec = this.createRec(this.moveBase, this.mousePosition);
             this.multiSelected = this.getMulSelect(rec);
             this.setMulSelectSymbol();
             if (this.multiSelected.Count == 1)
             {
                 this.selectedShape = (VMNode1)this.multiSelected[0];
                 this.multiSelected.RemoveAt(0);
             }
             this.wantMulSelect = false;
             this.moveBase      = this.mousePosition;
             this.mulSelRec     = this.createRec(this.moveBase, this.mousePosition);
         }
     }
     this.wantMovePoint = -1;
     this.Refresh();
 }
Beispiel #3
0
 private void addLine(VMLine1 line)
 {
     this.dataDoc.AddLine(line);
 }
Beispiel #4
0
 private bool deleteLinePoint(VMLine1 line, Point point)
 {
     return(line.deletePoint(point));
 }
Beispiel #5
0
 private Point[] checkPointInLine(Point point, ref int index, ref VMLine1 line)
 {
     return(this.dataDoc.checkPointInLine(point, ref index, ref line));
 }