Bootstrap

用C++编绘图控件工具

话不多说,

直接上代码:

#include <graphics.h>
#include <cstdio>
#include <cmath>
using namespace std;
class Point
{
protected:
    int x;
    int y;
    int r;
    int x1;
    int y1;
public:
    Point()
    {
        x = 0;
        y = 0;
        r = 0;
        x1= 0;
        y1= 0;
    }
     virtual void set(int a, int b)=0;
     virtual void setstart(int a,int b)=0;
     virtual void draw()=0;
     virtual void drawf()=0;
     int getx() const
    {
        return x;
    }

     int gety() const
    {
        return y;
    }
};
class MyCircle:public Point//圆类
{
     virtual void set(int a, int b)
    {
        int dx = getx() - a;
        int dy = gety() -b;
        r = (int)sqrt(dx * dx + dy * dy);
        x1=a;
        y1=b;
    }

     virtual void setstart(int a,int b)//定初始点
    {
        x = a;
        y = b;
        r = 0;
        x1=a;
        y1=b;
    }

     virtual void draw()//画空心
    {
        circle(x, y, r);
    }

     virtual void drawf()//画实心
    {
       setfillstyle(SOLID_FILL,getcolor());
       pieslicef(x,y,0,360,r);
    }

};
class rcircle:public Point//椭圆类
{
public:
    virtual void set(int a,int b)
    {
        x1=getx() - a;
        y1=gety() - b;
    }

    virtual void setstart(int a,int b)//椭圆定初始点
    {
        x = a;
        y = b;
        r = 0;
        x1= 0;
        y1= 0;
    }

    virtual  void draw()
    {
        ellipsef(x,y,0,360,x1,y1);
    }

    virtual   void drawf()
    {
        setfillstyle(SOLID_FILL,getcolor());
    fillellipse(x,y,x1,y1);
    }
};
class Myline:public MyCircle//线类
{
public:
    virtual  void draw()
    {
        line(x,y,x1,y1);
    }

    virtual  void drawf()
    {
        line(x,y,x1,y1);
    }
};
class Ju:public MyCircle//矩形类
{
public:
   virtual  void draw()
    {
        rectangle(x,y,x1,y1);
    }

   virtual void d
;