Beispiel #1
0
        private void Form_Splash_Load(object sender, EventArgs e)
        {
            //labelVersion.Text = AppInfo.GetVersionInfo();
            labelAppName.Text = AppInfo.GetName();

            #region
            //读取注册表用户名跟密码
            RegistryKey rsg = null;
            //Registry.Users.CreateSubKey(LoginInfo.RegeditPathString);
            rsg = Registry.Users.CreateSubKey(LoginInfo.RegeditPathString);
            if (rsg.GetValue("first") != null) //读取失败返回null
            {
                FirstFlag = Convert.ToBoolean(rsg.GetValue("first"));
            }
            if (rsg.GetValue("issavepsd") != null) //读取失败返回null
            {
                this.chkSavePWD.Checked = Convert.ToBoolean(rsg.GetValue("issavepsd"));
            }
            if (rsg.GetValue("username") != null) //读取失败返回null
            {
                this.txbUserName.Text = rsg.GetValue("username").ToString();
            }
            if (this.chkSavePWD.Checked == true)
            {
                if (rsg.GetValue("password") != null) //读取失败返回null
                {
                    this.txbPassWord.Text   = rsg.GetValue("password").ToString();
                    this.chkSavePWD.Checked = true;
                }
            }
            rsg.Close();
            #endregion
        }
Beispiel #2
0
 public void Init()
 {
     #region Init
     #region FormInit
     this.Size = FormNomalSize;
     this.Text = AppInfo.GetName();
     #endregion
     formMainShow = new Form_MainShow(this);
     formMainShow.Init();
     //Thread.Sleep(400);
     #endregion
 }
Beispiel #3
0
 public Form_Main()
 {
     InitializeComponent();
     参数设定ToolStripMenuItem.Enabled = LoginInfo.IsManager;
     #region Init
     #region FormInit
     this.Size = FormNomalSize;
     this.Text = AppInfo.GetName();
     #endregion
     formMainShow = new Form_MainShow(this);
     formMainShow.Init();
     //Thread.Sleep(400);
     #endregion
 }
Beispiel #4
0
        MemoryStream Export(bool isPrivate)
        {
            HSSFWorkbook workBook = new HSSFWorkbook();
            HSSFSheet    sheet    = (HSSFSheet)workBook.CreateSheet();

            #region 右击文件属性信息
            {
                DocumentSummaryInformation dsi = PropertySetFactory.CreateDocumentSummaryInformation();

                dsi.Company = "DuGu";
                workBook.DocumentSummaryInformation = dsi;

                SummaryInformation si = PropertySetFactory.CreateSummaryInformation();
                si.Author                   = "DuGu";
                si.ApplicationName          = "DuGu_NPOI_" + AppInfo.GetName();
                si.LastAuthor               = "DuGu";
                si.Comments                 = "DuGu";
                si.Title                    = "DuGu";
                si.Subject                  = "DemarcateResults";
                si.CreateDateTime           = DateTime.Now;
                workBook.SummaryInformation = si;
            }
            #endregion

            HSSFCellStyle  dateStyle = (HSSFCellStyle)workBook.CreateCellStyle();
            HSSFDataFormat format    = (HSSFDataFormat)workBook.CreateDataFormat();
            dateStyle.DataFormat = format.GetFormat("yyyy-mm-dd");

            int[] arrColWidth = { 20, 20, 20, 20, 20, 20, 20, 20 };
            #region 表头样式
            HSSFRow headerRow = (HSSFRow)sheet.CreateRow(0);
            headerRow.HeightInPoints = 25;
            headerRow.CreateCell(0).SetCellValue(strHeaderText);

            HSSFCellStyle headStyle = (HSSFCellStyle)workBook.CreateCellStyle();
            headStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
            HSSFFont font = (HSSFFont)workBook.CreateFont();
            font.FontHeightInPoints = 25;
            font.Boldweight         = 400;
            headStyle.SetFont(font);
            headerRow.GetCell(0).CellStyle = headStyle;
            sheet.AddMergedRegion(new NPOI.SS.Util.Region(0, 0, 0, ColumnCount - 1));
            #endregion

            headerRow               = (HSSFRow)sheet.CreateRow(1);
            headStyle.Alignment     = NPOI.SS.UserModel.HorizontalAlignment.Center;
            font.FontHeightInPoints = 25;
            font.Boldweight         = 400;
            headStyle.SetFont(font);
            ExportOptions exportOptions = new ExportOptions();
            for (int i = 0; i < ColumnCount; ++i)
            {
                headerRow.CreateCell(i).SetCellValue(exportOptions.TableString[i]);
                headerRow.GetCell(i).CellStyle = headStyle;
                sheet.SetColumnWidth(i, (arrColWidth[i] + 1) * 256);
            }
            for (int i = 0; i < 12; ++i)
            {
                headerRow               = (HSSFRow)sheet.CreateRow(i + 2);
                headStyle.Alignment     = NPOI.SS.UserModel.HorizontalAlignment.Center;
                font.FontHeightInPoints = 15;
                font.Boldweight         = 400;
                headStyle.SetFont(font);

                headerRow.CreateCell(0).SetCellValue(i + 1);
                headerRow.GetCell(0).CellStyle = headStyle;
                if (demaMotionArray != null)
                {
                    for (int j = 1; j < ColumnCount; ++j)
                    {
                        headerRow.CreateCell(j).SetCellValue(demaMotionArray[i].Para[j - 1].ToString());
                        headerRow.GetCell(j).CellStyle = headStyle;
                        sheet.SetColumnWidth(j, (arrColWidth[j] + 1) * 256);
                    }
                }
                if (demaMotionList != null)
                {
                    for (int j = 1; j < ColumnCount; ++j)
                    {
                        headerRow.CreateCell(j).SetCellValue(demaMotionList[i].Para[j - 1].ToString());
                        headerRow.GetCell(j).CellStyle = headStyle;
                        sheet.SetColumnWidth(j, (arrColWidth[j] + 1) * 256);
                    }
                }
            }
            using (MemoryStream ms = new MemoryStream())
            {
                workBook.Write(ms);
                ms.Flush();
                ms.Position = 0;
                return(ms);
            }
        }