Beispiel #1
0
        public void CreateFromPoints(CCoordinate point1, CCoordinate point2)
        {
            this.m_Coordinate = new CCoordinate();

            if (point1.X < point2.X && point1.Y > point2.Y)
            {
                this.m_Coordinate.X = point1.X;
                this.m_Coordinate.Y = point2.Y;
            }
            else if (point2.X < point1.X && point1.Y > point2.Y)
            {
                this.m_Coordinate = point2;
            }
            else if (point2.X < point1.X && point1.Y < point2.Y)
            {
                this.m_Coordinate.X = point2.X;
                this.m_Coordinate.Y = point1.Y;
            }
            else
            {
                this.m_Coordinate = point1;
            }
            this.m_Width  = Math.Abs(point2.X - point1.X);
            this.m_Height = Math.Abs(point2.Y - point1.Y);
        }
Beispiel #2
0
 private void picObrazek_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     koncowyPunkt = new CCoordinate(e.X, e.Y);
     //w zaleznosci od zaznaczonego radio buttona dodaj figurę
     if (rbLinia.Checked)
     {
         CLine linia = new CLine();
         linia.CreateFromPoints(punkt, koncowyPunkt);
         drawing.AddShape(linia);
     }
     if (rbProstokąt.Checked)
     {
         CRectangle prostokat = new CRectangle();
         prostokat.CreateFromPoints(punkt, koncowyPunkt);
         drawing.AddShape(prostokat);
         //Dodaj nowy prostokąt
     }
     if (rbOkrąg.Checked)
     {
         CCircle okrag = new CCircle();
         okrag.CreateFromPoints(punkt, koncowyPunkt);
         drawing.AddShape(okrag);
         //Dodaj nowy okrąg
     }
     drawPicture();
 }
Beispiel #3
0
 public CRectangle(CCoordinate corner, int width, int height)
 {
     this.m_Coordinate = corner;
     this.m_Width      = width;
     this.m_Height     = height;
 }
Beispiel #4
0
 public void CreateFromPoints(CCoordinate point1, CCoordinate point2)
 {
     this.m_Coordinate = point1;
     this.m_End        = point2;
 }
Beispiel #5
0
 public CLine(CCoordinate point1, CCoordinate point2)
 {
     this.m_Coordinate = point1;
     this.m_End        = point2;
 }
Beispiel #6
0
 public virtual void CreateFromPoints(CCoordinate point1, CCoordinate point2)
 {
 }
Beispiel #7
0
 private void picObrazek_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     punkt = new CCoordinate(e.X, e.Y);
     drawMark(e.X, e.Y);
 }
Beispiel #8
0
 public CCircle(CCoordinate center, int radius)
 {
     this.m_Coordinate = center;
     this.m_Radius     = radius;
 }
Beispiel #9
0
 public void CreateFromPoints(CCoordinate point1, CCoordinate point2)
 {
     this.m_Coordinate = point1;
     this.m_Radius     = (float)Math.Sqrt(Math.Pow(point1.Y - point2.Y, 2) + Math.Pow(point2.X - point1.X, 2));
 }