• 开源一个sheet表格类


    可以建立表格,输入内容,居中显示
    #include <iostream>
    #include <conio.h>
    #include <string>
    #include <graphics.h>
    using namespace std;
    class sheet{
    public:
        sheet(int l=5,int c=5,int width=80,int highth=40,int posx=0,int posy=0);
        //行数,列数,行宽,列宽,起始位置x,y
        void put_txt(int x,int y,char *s);
    private:
        int col,lin,col_high,lin_width,pos_x,pos_y;
    };
    sheet::sheet(int l,int c,int width,int highth,int posx,int posy)
    {
        col=c;
        lin=l;
        lin_width=width;
        col_high=highth;
        pos_x=posx;
        pos_y=posy;
        int grax,gray;
        grax=col*lin_width;
        gray=lin*col_high;
        int i,j;
        for(i=0;i<=grax;i+=lin_width)
            line(i+pos_x,0+pos_y,i+pos_x,gray+pos_y);
        for(j=0;j<=gray;j+=col_high)
            line(0+pos_x,j+pos_y,grax+pos_x,j+pos_y);
    }
    void sheet::put_txt(int x,int y,char *s)
    {
        outtextxy((x-1)*lin_width+20+pos_x,(y-1)*col_high+8+pos_y,s);
    }

    int main()
    {
        initgraph(800,600);
    //  sheet a(15,6,100,30,20,20);
        sheet a;
        string s="张三";
        a.put_txt(2,2,s);
        getch();
    }
  • 相关阅读:
    监听器和过滤器
    jdbc电话本项目
    jdbc数据库中的增删改
    servlet实现登陆注册
    Python 数据分析基础小结
    分类模型构建
    回归模型构建
    sklearn——数据集调用及应用
    数据处理——数据集划分
    数据分析——Matplotlib图形绘制
  • 原文地址:https://www.cnblogs.com/ma6174/p/2309495.html
Copyright © 2020-2023  润新知