zoukankan      html  css  js  c++  java
  • 开源一个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();
    }
  • 相关阅读:
    关于Java 下 Snappy压缩存文件
    英文分词和中文分词
    vuex requires a Promise polyfill in this browser
    Vue 中 export default 和 module.exports
    Linux 进程以及多线程的支持
    mysqldump
    linux磁 盘分区 挂载
    ubuntu16.04挂载windows NTFS磁盘方法
    Linux服务管理 systemctl命令详解
    nextcloud 安装
  • 原文地址:https://www.cnblogs.com/ma6174/p/2309495.html
Copyright © 2011-2022 走看看