Example #1
0
        public override string createHtmlView()
        {
            tableLayout layform = new tableLayout();

            if (layform.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return("");
            }

            int    colnum = 1;
            int    rownum = 1;
            string w      = layform.width.Text;
            string h      = layform.height.Text;

            int wal  = 0;
            int hval = 0;

            try
            {
                colnum = Convert.ToInt32(layform.colnum.Text);
                rownum = Convert.ToInt32(layform.rownum.Text);

                wal  = Convert.ToInt32(w);
                hval = Convert.ToInt32(h);

                if (colnum < 1 || rownum < 1)
                {
                    System.Windows.Forms.MessageBox.Show("请正确填写行列值");
                    return("");
                }
            }
            catch (Exception exp)
            {
                System.Windows.Forms.MessageBox.Show("请正确填写行列值");
                return("");
            }

            /*  string html = "<table ltype='_table' style='width:800px;height:" + h + ";border:1px;border-color:#aaaaaa;border-style:solid' cellpadding=0 cellspacing=0>";
             * for (int i = 0; i < colnum; i++)
             * {
             *     html += "<tr ltype='_tableTR' >";
             *     //html += "<td style='white-space:nowrap;'>";
             *      for (int j = 0; j < rownum; j++)
             *      {
             *         html += "<td ltype='_tableTD' style='height:auto;width:auto;border:1px;border-color:#aaaaaa;border-style:solid' cellpadding=0 cellspacing=0>";
             *
             *
             *        // html += "<div   ltype='_tableDIV' style='width;auto;height:100%;border:1px;border-color:#aadddd;border-style:solid'>&nbsp</div>";
             *
             *         //    html += "<table style='width:100%;height:100%;border:1px;border-color:#aadddd;border-style:solid'>";
             *          //   html += "<tr><td>&nbsp;</td></tr>";
             *          //   html += "</table>";
             *           html += "</td>";
             *
             *      }
             *    // html += "</td>";
             *      html += "</tr>";
             * }
             * html += "</table>";*/


            string html = "<table style='width:auto;height:auto' cType='eq_lay' dblink='" + baseLayout.layoutTypes.CUS_LAYL_TABLE + "'>";// "<div ltype='_containerDIV'  style=' height:300px;width:" + (204 * colnum + 4).ToString() + "px;border:1px;border-color:#aaaaaa;border-style:solid' cellpadding=0 cellspacing=0>";

            for (int i = 0; i < colnum; i++)
            {
                int    v  = (int)((float)hval / colnum);
                string hs = v.ToString() + "px";
                //   html += "<div colidx='" + i.ToString() + "' style='width:auto' ltype='_colDIV'>";
                html += "<tr><td  ltype='_colDIV' style='width:auto;height:auto'>";
                for (int j = 0; j < rownum; j++)
                {
                    int val = (int)((float)wal / rownum);

                    string ws = val.ToString() + "px";
                    // html += "<div  ltype='_tableDIV' style='width;"+ws+";height:" + hs + ";border:1px;border-color:#aadddd;border-style:solid;float:left'><div style='width:200px'/></div>";

                    html += "<div colidx='" + i.ToString() + "' rowidx ='" + j.ToString() + "' ltype='_cellDIV' style='width:" + ws + ";height:" + hs + ";border:1px;border-color:#aadddd;border-style:solid;float:left'> </div>";
                }
                //html += "</div>";
                html += "</td></tr>";
            }
            html += "</table>";
            //html += "</div>" ;
            //   html += "<script type=\"text/javascript\">";
            //  html += "function resizeLay(obj){";
            //   html += "alert('hi')";
            //   html += "}</script>";



            return(html);
        }
        public override string createHtmlView()
        {
            tableLayout layform = new tableLayout();
            if (layform.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return "";

            int colnum = 1;
            int rownum=1 ;
            string w = layform.width.Text ;
            string h = layform.height.Text ;

            int wal = 0;
            int hval = 0;

            try
            {
                colnum = Convert.ToInt32(layform.colnum.Text);
                rownum = Convert.ToInt32(layform.rownum.Text);

                if(colnum<1 || rownum<1)
                {
                     System.Windows.Forms.MessageBox.Show("请正确填写行列值") ;
                     return "" ;
                }

            }
            catch(Exception exp)
            {
                System.Windows.Forms.MessageBox.Show("请正确填写行列值") ;
                return "" ;
            }
             /*  string html = "<table ltype='_table' style='width:800px;height:" + h + ";border:1px;border-color:#aaaaaa;border-style:solid' cellpadding=0 cellspacing=0>";
            for (int i = 0; i < colnum; i++)
            {
                html += "<tr ltype='_tableTR' >";
                //html += "<td style='white-space:nowrap;'>";
                 for (int j = 0; j < rownum; j++)
                 {
                    html += "<td ltype='_tableTD' style='height:auto;width:auto;border:1px;border-color:#aaaaaa;border-style:solid' cellpadding=0 cellspacing=0>";

                   // html += "<div   ltype='_tableDIV' style='width;auto;height:100%;border:1px;border-color:#aadddd;border-style:solid'>&nbsp</div>";

                    //    html += "<table style='width:100%;height:100%;border:1px;border-color:#aadddd;border-style:solid'>";
                     //   html += "<tr><td>&nbsp;</td></tr>";
                     //   html += "</table>";
                      html += "</td>";

                 }
               // html += "</td>";
                 html += "</tr>";
            }
            html += "</table>";*/

            string html = "<table>";// "<div ltype='_containerDIV'  style=' height:300px;width:" + (204 * colnum + 4).ToString() + "px;border:1px;border-color:#aaaaaa;border-style:solid' cellpadding=0 cellspacing=0>";

            for (int i = 0; i < colnum; i++)
            {
                int v = (int)((float)300 / colnum);
                string hs = v.ToString() + "px";
              //   html += "<div colidx='" + i.ToString() + "' style='width:auto' ltype='_colDIV'>";
                html += "<tr><td  ltype='_colDIV'>";
                for (int j = 0; j < rownum; j++)
                {

                    int val = (int)((float)600.00 / rownum);

                    string ws =   val.ToString() + "px";
                   // html += "<div  ltype='_tableDIV' style='width;"+ws+";height:" + hs + ";border:1px;border-color:#aadddd;border-style:solid;float:left'><div style='width:200px'/></div>";

                    html += "<div colidx='" + i.ToString() + "' rowidx ='" + j.ToString() + "' ltype='_cellDIV' style='width:" + w + ";height:" + h + ";border:1px;border-color:#aadddd;border-style:solid;float:left'> </div>";

                }
                //html += "</div>";
                html += "</td></tr>";

            }
            html += "</table>";
            //html += "</div>" ;
              //   html += "<script type=\"text/javascript\">";
               //  html += "function resizeLay(obj){";
              //   html += "alert('hi')";
              //   html += "}</script>";

            return html;
        }