Esempio n. 1
0
 //Retrieves a Line object having a mark
 private Line getLineByMark(MarkControl m)
 {
     foreach (Line l in  ((BaseWindow)this.baseFrame.Parent).Lines)
     {
         if (l.mark1 == m || l.mark2 == m)
         {
             return(l);
         }
     }//Never happens :D
     throw new System.Exception("No line found");
 }
Esempio n. 2
0
        private void Mark_MouseMove(object sender, MouseEventArgs e)
        {
            if (isSelected)
            {
                MarkControl mc1 = (MarkControl)sender;
                Line        l   = getLineByMark(mc1);

                Point p = new Point(e.X - _X + mc1.Left, e.Y - _Y + mc1.Top);

                mc1.Location = p;

                Redraw(l, p);
            }
        }
Esempio n. 3
0
        private void createLine()
        {
            try
            {
                //Adds red marks that are the beginning/end of the line
                MarkControl mark1 = new MarkControl();
                mark1.Location    = new Point(100, 100);
                mark1.ContextMenu = linecmenu;
                baseFrame.Controls.Add(mark1);

                MarkControl mark2 = new MarkControl();
                mark2.Location    = new Point(200, 200);
                mark2.ContextMenu = linecmenu;
                baseFrame.Controls.Add(mark2);

                //Line Struct contains the information for a single line
                Line line = new Line();
                line.mark1 = mark1;
                line.mark2 = mark2;
                line.Width = 1;


                //Events for moving marks
                mark1.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseUp);
                mark1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseDown);
                mark1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseMove);

                mark2.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseUp);
                mark2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseDown);
                mark2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseMove);

                //Adds Line object to an arraylist
                ((BaseWindow)this.baseFrame.Parent).Lines.Add(line);
                Redraw();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 4
0
 //Retrieves a Line object having a mark
 private Line getLineByMark(MarkControl m)
 {
     foreach (Line l in  ((BaseWindow)this.baseFrame.Parent).Lines)
     {
         if (l.mark1 == m || l.mark2 == m)
             return l;
     }//Never happens :D
     throw new System.Exception("No line found");
 }
Esempio n. 5
0
        private void createLine()
        {
            try
            {
                //Adds red marks that are the beginning/end of the line
                MarkControl mark1 = new MarkControl();
                mark1.Location = new Point(100, 100);
                mark1.ContextMenu = linecmenu;
                baseFrame.Controls.Add(mark1);

                MarkControl mark2 = new MarkControl();
                mark2.Location = new Point(200, 200);
                mark2.ContextMenu = linecmenu;
                baseFrame.Controls.Add(mark2);

                //Line Struct contains the information for a single line
                Line line = new Line();
                line.mark1 = mark1;
                line.mark2 = mark2;
                line.Width = 1;

                //Events for moving marks
                mark1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseUp);
                mark1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseDown);
                mark1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseMove);

                mark2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseUp);
                mark2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseDown);
                mark2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Mark_MouseMove);

                //Adds Line object to an arraylist
                 ((BaseWindow)this.baseFrame.Parent).Lines.Add(line);
                Redraw();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }